You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nav offcanvas - creating a menu from the block list view transfers focus back to canvas #47018
changed the title [-]Nav offcanvas - inserting block transfers focused back to canvas[/-][+]Nav offcanvas - inserting block transfers focus back to canvas[/+]on Jan 10, 2023
Edit: I think the issue in the video is that a menu was created, and I think it's that causing the focus loss. In general usage I don't see any issues with focus being transferred.
If you have no menus then inserting a Navigation block will create an "auto menu" which is basically a Page List block.
If you then use the Nav list view to insert a new block into this menu then a new Navigation menu (wp_navigation) will be created. However the creation of the menu causes focus to be lost from the list view and transfered to the editor iframe.
Note how in the video below the focus gets transferred to the iframe when the menu is created. Note also that once the menu is created and I add a item to the menu, focus is handled correctly.
Screen.Capture.on.2023-01-11.at.10-05-06.mp4
When a menu is created the focus should remain in the Nav list view.
I tested this some more and I found that the selected block in the editor state is the Navigation block. But the focus is not on that block - somehow it ends up on an iframe.
changed the title [-]Nav offcanvas - inserting block transfers focus back to canvas[/-][+]Nav offcanvas - creating a menu from the block list view transfers focus back to canvas[/+]on Jan 26, 2023
Activity
[-]Nav offcanvas - inserting block transfers focused back to canvas[/-][+]Nav offcanvas - inserting block transfers focus back to canvas[/+]talldan commentedon Jan 11, 2023
It's weird because the
Insertercomponent hasselectBlockOnInsert={ false }specified:gutenberg/packages/block-editor/src/components/off-canvas-editor/appender.js
Lines 36 to 45 in a4879a6
I guess that prop doesn't work.
Edit: I think the issue in the video is that a menu was created, and I think it's that causing the focus loss. In general usage I don't see any issues with focus being transferred.
getdave commentedon Jan 11, 2023
I have a sneaking suspicion that "focus" and "selected" are different things. I could be wrong...
getdave commentedon Jan 11, 2023
I figured this out. It's as @talldan suspected.
If you have no menus then inserting a Navigation block will create an "auto menu" which is basically a Page List block.
If you then use the Nav list view to insert a new block into this menu then a new Navigation menu (
wp_navigation) will be created. However the creation of the menu causes focus to be lost from the list view and transfered to the editor iframe.Note how in the video below the focus gets transferred to the iframe when the menu is created. Note also that once the menu is created and I add a item to the menu, focus is handled correctly.
Screen.Capture.on.2023-01-11.at.10-05-06.mp4
When a menu is created the focus should remain in the Nav list view.
getdave commentedon Jan 11, 2023
I tested this some more and I found that the selected block in the editor state is the Navigation block. But the focus is not on that block - somehow it ends up on an iframe.
I suspect this may be a wider bug...
jasmussen commentedon Jan 13, 2023
CC: @ellatrix per the iframe.
[-]Nav offcanvas - inserting block transfers focus back to canvas[/-][+]Nav offcanvas - creating a menu from the block list view transfers focus back to canvas[/+]