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
With IE 11, tabbing from one block to the following block doesn't make the "sibling" inserter button appear. Tabbing again, focus is lost and the tab sequence starts from scratch from the document root.
This makes impossible to tab through blocks, since focus constantly fallbacks to the document root.
Happens also when tabbing from the title to the following block. To reproduce:
1: click on the title
2: press Tab (seems focus goes somewhere and then is lost immediately)
3: press Tab: focus starts from scratch from the skip link
Dumping something in the console to check when the relevant functions run:
Chrome macOS: Not sure why they run multiple times after a single Tab press (maybe because it re-renders?)
This is caused by the onBlur handler in SiblingInserter. The div gets focused, and then immediately focuses the button inside. That fires a blur on the div, which calls hide.
Note, this seems to be resolved by just ensuring that the newly focused item (document.activeElement) isn't contained by the div before firing hide. It seems to work on all browsers from some cursory testing, but if we hit problems, we might need to use the withFocusOutside HOC again.
Note, that I needed the PR #3415 to even begin debugging this. I'm not sure how you were able to get so far @afercia ! :) My Gutenberg just kept crashing due to the startsWith issue.
I was wondering why there's the need of the wrapper div and the focus management in the first place. Wouldn't be simpler to have the sibling inserter button always rendered and visually hidden? There are simple CSS techniques to visually hide elements and still keep them focusable. On focus, just a className update can reveal the element. Something like the row action links in the WordPress list tables.
I was wondering why there's the need of the wrapper div and the focus management in the first place.
Originally this was intended as an optimization to avoid unnecessary DOM nodes, since a between-inserter-per-block could lead to an excessive number of nodes and therefore potential for a performance impact. However, given that as implemented, the Inserter component contains its own logic for rendering only when open and is otherwise limited to a single node, there really may not be need for this after-all and could be simplified.
Basic empty DIV that is focusable when it is not focused or visible
Unwrapped Inserter dropdown button when it is visible / focused
I've also noticed that it seems like moving the mouse can make the inserter button disappear, even when it is focused. I assume that's not desired behaviour?
Activity
ephox-mogran commentedon Nov 10, 2017
This is caused by the
onBlurhandler inSiblingInserter. The div gets focused, and then immediately focuses the button inside. That fires abluron the div, which callshide.Note, this seems to be resolved by just ensuring that the newly focused item (
document.activeElement) isn't contained by the div before firinghide. It seems to work on all browsers from some cursory testing, but if we hit problems, we might need to use thewithFocusOutsideHOC again.ephox-mogran commentedon Nov 10, 2017
Note, that I needed the PR #3415 to even begin debugging this. I'm not sure how you were able to get so far @afercia ! :) My Gutenberg just kept crashing due to the
startsWithissue.afercia commentedon Nov 10, 2017
Old-school methods 😬
I was wondering why there's the need of the wrapper div and the focus management in the first place. Wouldn't be simpler to have the sibling inserter button always rendered and visually hidden? There are simple CSS techniques to visually hide elements and still keep them focusable. On focus, just a className update can reveal the element. Something like the row action links in the WordPress list tables.
aduth commentedon Nov 13, 2017
Originally this was intended as an optimization to avoid unnecessary DOM nodes, since a between-inserter-per-block could lead to an excessive number of nodes and therefore potential for a performance impact. However, given that as implemented, the Inserter component contains its own logic for rendering only when open and is otherwise limited to a single node, there really may not be need for this after-all and could be simplified.
ephox-mogran commentedon Nov 14, 2017
So is this the simplification we want:
I've also noticed that it seems like moving the mouse can make the inserter button disappear, even when it is focused. I assume that's not desired behaviour?
afercia commentedon Nov 15, 2017
Hm couldn't this be done with just CSS? Not sure why there's the need of a focusable empty DIV.