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

Navigation block: unable to explore block settings moving with Tab key #61315

Open
talksina opened this issue May 2, 2024 · 6 comments · May be fixed by #61374
Open

Navigation block: unable to explore block settings moving with Tab key #61315

talksina opened this issue May 2, 2024 · 6 comments · May be fixed by #61374
Assignees
Labels
[Block] Navigation Link Affects the Navigation Link Block [Block] Navigation Affects the Navigation Block [Block] Submenu Affects the Submenu Block - for submenus in navigation [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@talksina
Copy link

talksina commented May 2, 2024

Description

In Gutenberg's block editor, when adding a Navigation block to insert a menu in the content, the single menu items have a serious keyboard issue: tabbing through settings, brings the focus back to the content.
Expected result: after adding a menu item in a Navigation block, pressing the Tab key on the selected menu item just added, should take keyboard focus to the single block's settings: link text, title attribute, rel attribute, advanced...
Current result: pressing Tab, after reaching the collapsible button "block settings", takes to a control called "drag to resize", which is in the block's content. It might be a tabindexing bug. Happens with all screen readers (Jaws for Windows, NVDA, VoiceOver)...

Step-by-step reproduction instructions

  1. Pre-requirements: test it with or without screen readers, pressing the Tab key. Jaws and NVDA for Windows must be tested both with and without virtual cursor for Jaws (jawskey plus z) or focus mode (NVDA key plus space) for NVDA. Test it by adding the block in contents or templates.
  2. Create a blank content -post, page, template...-
  3. Add a Navigation block, and create a blank menu from it.
  4. Add a new menu item. Page link, post link, custom link or whatever is the same. Affecting both parent menu items and child menu items in submenus. Affects also menus without any submenu.
  5. Select (with arrow keys) the block you have just added. Let's assume the link's called "about us".
  6. Once on the "about us" link text or block, press the Tab key. You should go smoothly until "block settings" collapsible button.
  7. One more tab, and keyboard focus will land on the "drag to resize" item. That's not the way it should work, tab should focus all the settings as it does in other blocks. Only workaround found is to turn focus mode off, or virtual mode on, going through the editor as a readable Word document and access the setting manually using the "search in page" screen reader command.

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.5.2, Gutenberg 18.2 stable. Windows 11 with Jaws for Windows 2024, then NVDA 2024.1. Theme used: default WordPress theme, twenty-twentyfour. Browsers: latest Chrome, latest Edge, Safari. On iOS 17.4 with VoiceOver, block's settings are not accessible at all. Devices used: Microsoft Surface Pro with Windows 11, iPhone 13 pro max with iOS 17.4 landscape and portrait mode, iPad Mini 6 with iPadOS17.4 landscape and portrait mode with VoiceOver screen reader, both with and without hardware keyboard connected.

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

@talksina talksina added the [Type] Bug An existing feature does not function as intended label May 2, 2024
@joedolson joedolson added Needs Accessibility Feedback Need input from accessibility [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels May 2, 2024
@talldan
Copy link
Contributor

talldan commented May 3, 2024

Thanks for reporting this. I see slightly different behavior ('drag to resize' doesn't seem to become focused), but on the whole have the same bug, so what I describe below might be slightly different.

I think it's something that happens when interacting with the 'Text' input in the block's sidebar, it causes the block's content to be replaced in the DOM.

When blurring that field, the RichText contenteditable is re-inserted into the DOM, and it might be autofocusing somehow.

With Voiceover active, it happens as soon as I tab into the 'Text' input, without it active it happens when I blur the input.

Here's the relevant code:

onFocus={ () => setIsLabelFieldFocused( true ) }
onBlur={ () => setIsLabelFieldFocused( false ) }

! isLabelFieldFocused && (
<>
<RichText
ref={ ref }
identifier="label"
className="wp-block-navigation-item__label"
value={ label }
onChange={ ( labelValue ) =>
setAttributes( {
label: labelValue,
} )
}
onMerge={ mergeBlocks }
onReplace={ onReplace }
__unstableOnSplitAtEnd={ () =>
insertBlocksAfter(
createBlock(
'core/navigation-link'
)
)
}
aria-label={ __(
'Navigation link text'
) }
placeholder={ itemLabelPlaceholder }
withoutInteractiveFormatting
allowedFormats={ [
'core/bold',
'core/italic',
'core/image',
'core/strikethrough',
] }
/>

@alexstine
Copy link
Contributor

I could not reproduce this in Firefox, browser specific?

@talksina
Copy link
Author

talksina commented May 3, 2024

Found it in Chrome and Edge. Go to "edit mode" from the newly added menu item, then tab after the "block settings". Where you find "block" and "styles" tabs. Go ahead with Tab key, I think you won't reach the element's attributes. If you have it on, turn virtual cursor off. Or focus mode on, with NVDA. Don't know VoiceOver as I no longer have a mac with me.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 3, 2024
@alexstine
Copy link
Contributor

@talksina Finally figured out how to reproduce this. I made a fix but it's fairly complicated. Let's see if I can get it reviewed.

@talldan You were on the right track but that wasn't it. Please see my PR.

#61374

It appears you found the attempted patch but not the fix. Essentially, the fix did not work I think because the re-rendering onBlur also takes focus. Either that or onChange is picking up the tab out of the input.

Thanks.

@talldan talldan added [Block] Navigation Affects the Navigation Block [Block] Navigation Link Affects the Navigation Link Block [Block] Submenu Affects the Submenu Block - for submenus in navigation labels May 6, 2024
@talksina
Copy link
Author

talksina commented May 9, 2024

Seems fixed in 18.3.0 but needs further tests from other users/devs. Please check it out

@alexstine
Copy link
Contributor

@talksina I can still reproduce the bug in Firefox. Still awaiting PR reviews... 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Link Affects the Navigation Link Block [Block] Navigation Affects the Navigation Block [Block] Submenu Affects the Submenu Block - for submenus in navigation [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
4 participants