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

Unable to shift+tab from post title #69486

Open
4 of 6 tasks
stokesman opened this issue Mar 7, 2025 · 6 comments · May be fixed by #69520
Open
4 of 6 tasks

Unable to shift+tab from post title #69486

stokesman opened this issue Mar 7, 2025 · 6 comments · May be fixed by #69520
Assignees
Labels
[Block] Post Title Affects the Post Title Block [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@stokesman
Copy link
Contributor

stokesman commented Mar 7, 2025

Description

When editing a post in "post-only" mode and the post title is focused then shift+tab doesn’t allow navigating out of the canvas. This happens in Gutenberg trunk and 6.8 beta1 whereas in 6.7 it doesn’t. In 6.7 it takes two-steps to get out of the canvas and that may not be ideal but at least it’s possible.

The expectation is that the "Options" button is focused when pressing shift+tab from the post title.

Step-by-step reproduction instructions

  1. Open a post in "post-only" view
  2. Move focus into the post title
  3. Press shift+tab repeatedly
  4. Confirm that it’s not possible to navigate out of the canvas

Screenshots, screen recording, code snippet

post-title-no-shift-tab-out-of-canvas.mp4

Environment info

  • WP 6.7.2 with Gutenberg plugin from trunk or WP 6.8 beta1
  • Chrome
  • macOS

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@stokesman stokesman added the [Type] Bug An existing feature does not function as intended label Mar 7, 2025
@t-hamano
Copy link
Contributor

t-hamano commented Mar 7, 2025

I was able to reproduce the issue on a Windows OS. When I launch the NVDA screen reader and run Shift + Tab repeatedly in the post title, the screen reader repeatedly reads the following:

section
Edit Post “Hello world!” ‹ gutenberg — WordPress  document   
main landmark
Editor content  region
Editor canvas  frame
document
section
Add title  edit  multi line  Hello world!

Ideally, the focus should move from the post title to the Options button?

@stokesman
Copy link
Contributor Author

Ideally, the focus should move from the post title to the Options button?

I think so. That’s where focus lands in 6.7 and it matches the the visual order.

@Mamaduka Mamaduka added [Block] Post Title Affects the Post Title Block [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). labels Mar 10, 2025
@Mamaduka Mamaduka moved this to ❓ Triage in WordPress 6.8 Editor Tasks Mar 10, 2025
@afercia afercia added [Type] Regression Related to a regression in the latest release and removed [Type] Bug An existing feature does not function as intended labels Mar 10, 2025
@afercia
Copy link
Contributor

afercia commented Mar 10, 2025

Thanks for reporting this issue. It's a keyboard trap that makes the post editor unusable for all keyboard users, not only for screen reader users.

It's not clear to me if ths issue occurs also in the editor version for WordPress 6.8. In that case, it's a blocker and should be fixed for the release.

@t-hamano
Copy link
Contributor

t-hamano commented Mar 10, 2025

I identified this issue as occurring in #69079. That is, this early return:

if ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {
return;
}

This is because the post title has no clientId.

@t-hamano t-hamano moved this from ❓ Triage to 📥 Todo in WordPress 6.8 Editor Tasks Mar 10, 2025
@t-hamano
Copy link
Contributor

We can solve this by checking if the current element is a post title, but I don't think hardcoding the CSS class names is ideal:

diff --git a/packages/block-editor/src/components/writing-flow/use-tab-nav.js b/packages/block-editor/src/components/writing-flow/use-tab-nav.js
index 7f06cfe651..304dffedb5 100644
--- a/packages/block-editor/src/components/writing-flow/use-tab-nav.js
+++ b/packages/block-editor/src/components/writing-flow/use-tab-nav.js
@@ -125,7 +125,15 @@ export default function useTabNav() {
                                return;
                        }
 
-                       if ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {
+                       const isPostTitle = event.target.classList.contains(
+                               'editor-post-title__input'
+                       );
+
+                       if (
+                               ! hasMultiSelection() &&
+                               ! getSelectedBlockClientId() &&
+                               ! isPostTitle
+                       ) {
                                return;
                        }

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 10, 2025
@stokesman
Copy link
Contributor Author

I identified this issue as occurring in #69079.

Yes, what’s curious about that is it restored an early return that had apparently not been causing this issue when it was there before. So what allowed shift+tab to work before? I tried figuring that out and gave up without success.

Noting that we restored the early return to fix #69037 (reasoning here: #69037 (comment)) and there are other ways we can fix that, I think we can remove it. I’ve put that (plus a little extra) in #69520.

@Mamaduka Mamaduka moved this from 📥 Todo to 🏗️ In Progress in WordPress 6.8 Editor Tasks Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Title Affects the Post Title Block [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
Status: 🏗️ In Progress
Development

Successfully merging a pull request may close this issue.

4 participants