Skip to content

fix(a11y): render nav dropdowns inline for correct keyboard tab order#17681

Open
macuzi wants to merge 5 commits intomasterfrom
macuzi/fix/nav-dropdown-tab-order
Open

fix(a11y): render nav dropdowns inline for correct keyboard tab order#17681
macuzi wants to merge 5 commits intomasterfrom
macuzi/fix/nav-dropdown-tab-order

Conversation

@macuzi
Copy link
Copy Markdown
Contributor

@macuzi macuzi commented May 8, 2026

DESCRIBE YOUR PR

The Concepts and Manage nav dropdowns were rendered using ReactDOM.createPortal to document.body, which placed their <a> tags at the bottom of the DOM — breaking keyboard tab order.

Before

// Dropdown links rendered at bottom of DOM via portal

ReactDOM.createPortal(                                                                  
  <div>               
   <Link href="/concepts/key-terms/">Key Terms</Link>                                  
    ...                                                                                
  </div>,                                                                               
  document.body                                                                        
) 

Keyboard users had to tab through the entire page before reaching dropdown items (in the video, you'll see it goes from "Concepts" → "API").

CleanShot.2026-05-07.at.19.45.44.mp4

After

Dropdowns render inline next to their trigger buttons, using position: fixed to escape the parent's overflow-x: auto clipping.

CleanShot.2026-05-07.at.20.27.55.mp4

Tab now flows naturally: Concepts → Key Terms → Search → ... → API.

Also added Escape key function to exit open dropdowns.

function handleKeyDown(e: KeyboardEvent) {
 if (e.key === 'Escape') {                                                             
  if (conceptsDropdownOpen) {                                                        
    setConceptsDropdownOpen(false);                                                   
    conceptsBtnRef.current?.focus();
   }      
                                                                             
 if (moreDropdownOpen) {                                                             
   setMoreDropdownOpen(false);
   moreBtnRef.current?.focus();                                                      
  }                                                                                  
 }                                                                                     
}

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

@macuzi macuzi requested review from rahulchhabria and sfanahata May 8, 2026 03:50
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment May 8, 2026 6:35pm
sentry-docs Ready Ready Preview, Comment May 8, 2026 6:35pm

Request Review

Comment thread src/components/TopNavClient.tsx
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dbc6c3c. Configure here.

Comment thread src/components/TopNavClient.tsx Outdated
Copy link
Copy Markdown
Contributor

@sfanahata sfanahata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤘 Looks great. Thank you for keeping on with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants