-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the bug
We are creating UI for being able to select nested blocks from a list of links. Added a new component which displays a root-level block and its inner first level children in a list of links. Clicking on a link triggers dispatch( 'core/editor' ).selectBlock( clientId )
with the relevant block's clientId
. For some reason instead of the block with the specified clientId
being selected its first inner child gets selected.
For example if the blocks are nested A > B > C then calling dispatch( 'core/editor' ).selectBlock( clientId )
with the clientId
of B
focuses on the block C
is instead. Debugging clientId
on these lines shows that for some reason this runs twice -- first time with the correct clientId
and the second time with the clientId
of the first inner block (C
).
Note that using selectBlock
with the root level element (A
in the example) selects the correct block.
PR and the line in the PR using selectBlock
: https://github.com/Automattic/amp-wp/pull/1347/files#diff-34cc40d7d5ae6b1abcceb3757490f8ecR45
Expected behavior
The block which clientId
is used with dispatch( 'core/editor' ).selectBlock
should be selected.
Additional context
- Gutenberg version: 3.6.2