gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Block toolbar: Invisible tab stop due to scrollable container

Open afercia opened this issue 2 years ago • 1 comments

Description

Spltting this out from https://github.com/WordPress/gutenberg/issues/57710#issuecomment-1884999150

Firefox makes scrollable elements focusable. More accurately, there must be two conditions to trigger this Firefox behavior:

  • The element must have a fixed height and a CSS overflow property that makes it scrollable e.g. auto or scroll.
  • With the auto value, the element content must trigger an actual content overflow ie. hte content height exceeds the container height.

This behavior can be reproduced in the block toolbar, when the 'Top toolbar' is enabled. Tabbing through the UI with the Tab key, there is an additional 'silent' tab stop compare to other browsers.

Silent tab stops are very confusing for keyboard and assistive technology users. It's a less than ideal experiences that needs to be fixed.

However, the block toolbar is not the only place where this behavior may happen. I think it's worth to revisit all the instanced in the editor where:

  • The CSS overflow property is auto or scroll.
  • Same for overflow-x or overflow-y.

This CSS techniques may seem useful at first but they actually introeuce a barriere for users. Specifically about the block toolbar, these lines:

https://github.com/WordPress/gutenberg/blob/cd548afcc23253e4be4b5ca382d3f4b19b9267f4/packages/block-editor/src/components/block-toolbar/style.scss#L11-L13

were added to make the toolbar horizontally scrollable on mobile. I'm not sure that's a great solution as it doesn't really solve the root problem and it does more harms than good.

Additionally, the height of the content of the toolbar may axceed the toolbar height. In this case, as reported at https://github.com/WordPress/gutenberg/issues/57710 tabbing through the block mover buttons triggers a vertical shift of all the other content within the toolbar. Animated GIF to illustrate:

shift

Step-by-step reproduction instructions

  • Edit a post.
  • Enable the 'Top toolbar'.
  • Test with Chrome first.
  • Select a paragraph so that the block toolbar is rendered within the top bar.
  • Using the Tab key, start tabbing from the WP logo.
  • Notice tha tab sequence is:
    1. WP logo
    2. Inserter toggle button.
    3. Block switcher button.

Screenshot to illustrate the tab sequence with Chrome:

chrome

  • Now test with Firefox.
  • Repeat the steps above.
  • Notice tha tab sequence is:
    1. WP logo
    2. Inserter toggle button.
    3. Silent tab stop (no element appears to have focus).
    4. Block switcher button.

Screenshot to illustrate the tab sequence with Firefox:

firefox

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

afercia avatar Jan 11 '24 15:01 afercia

I've opened a PR for this: https://github.com/WordPress/gutenberg/pull/85214

00kaku avatar Oct 20 '26 17:10 00kaku