Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOM: tabbable throws an error while editor in Select Mode #36844

Closed
ramonjd opened this issue Nov 25, 2021 · 2 comments
Closed

DOM: tabbable throws an error while editor in Select Mode #36844

ramonjd opened this issue Nov 25, 2021 · 2 comments
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] DOM /packages/dom [Type] Bug An existing feature does not function as intended

Comments

@ramonjd
Copy link
Member

ramonjd commented Nov 25, 2021

Description

When tabbing through elements in the Post Editor, tabbable.js throws an error when it cannot find a target element in its "focusable" array, which is an array of elements that are eligible for focus.

Screen Shot 2021-11-25 at 3 15 08 pm

The issue came to light in #35655. Props to @andrewserong for first documenting it.

As far as I can see, the error is thrown in tabbable.js because the focussed element doesn't appear in the array of focusable elements.

The index therefore is -1.

So when I logged things out like

	if ( index > -1 ) {
		focusables.length = index;
	} else {
		console.log( 'element index', element, index );
	}

The element is, more often than not, .block-selection-button_select-button, and this only happens when I enable select mode (hitting Esc in the editor).

Step-by-step reproduction instructions

  1. Open the Post Editor, preferably with a post that has a few blocks
  2. Enter Select Mode by hitting the Esc key. You'll know you're in Select mode when the block controls toolbar turns to black.
  3. Now open the Block Editor List View.
  4. Start tabbing around.

Screenshots, screen recording, code snippet

Kapture 2021-11-25 at 15 06 58

Environment info

  • WordPress 5.8.1
  • Gutenberg (trunk) as of November 25, 2021
  • Chrome, Firefox, Safari

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

@ramonjd ramonjd added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] DOM /packages/dom labels Nov 25, 2021
@alexstine
Copy link
Contributor

@ramonjd Is this still valid? I thought I remembered a PR that fixed this.

@ramonjd
Copy link
Member Author

ramonjd commented Apr 18, 2022

Is this still valid? I thought I remembered a PR that fixed this.

Thanks for the ping @alexstine

Looks like this was resolved by #38961

@ramonjd ramonjd closed this as completed Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] DOM /packages/dom [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants