-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
[Block] ImageAffects the Image BlockAffects the Image Block[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
When updating the aspectRatio attribute of a Core/Image block externally via wp.data.dispatch('core/block-editor').updateBlockAttributes, the block attribute updates correctly, but the visible dropdown in the block settings (DimensionsTool) does not reflect the new value.
The issue occurs because DimensionsTool is a controlled React component, and updating the attribute externally does not trigger a re-render of the dropdown UI.
Step-by-step reproduction instructions
Steps to Reproduce:
Insert an Image block in the editor.
Open the browser console and run:
wp.data.dispatch('core/block-editor').updateBlockAttributes(
'BLOCK_ID_HERE',
{ aspectRatio: '1/1' }
);
Check that the aspectRatio attribute in the block has updated.
Notice that the Aspect Ratio dropdown in the block sidebar does not visually update.
Screenshots, screen recording, code snippet
Link: https://bsf.d.pr/v/Uy9AKU
Environment info
- WordPress version: latest
- Gutenberg version: latest
- Browser: Chrome / Firefox (latest)
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Metadata
Metadata
Assignees
Labels
[Block] ImageAffects the Image BlockAffects the Image Block[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended