-
Notifications
You must be signed in to change notification settings - Fork 4k
[fix] Ensure anchor links in Markdown headers are accessible from keyboard #13378
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
[fix] Ensure anchor links in Markdown headers are accessible from keyboard #13378
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes keyboard accessibility for anchor links in Markdown headers (#13329) by ensuring the link icons are reachable via keyboard navigation. The key changes involve switching from visibility to opacity for hiding anchor icons (keeping them in tab order) and adding proper ARIA labels for accessibility.
Key Changes
- Modified CSS to use
opacity: 0instead ofvisibility: hiddenfor anchor link icons, keeping them keyboard-accessible - Added aria-label "Link to heading" to anchor links for screen reader support
- Implemented aria-labelledby pattern to maintain stable heading names when containing interactive elements
- Added Escape key handler for tooltips to improve keyboard navigation
- Created
tab_until_focusedE2E test utility for robust keyboard navigation testing
Reviewed changes
Copilot reviewed 6 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/lib/src/components/shared/Tooltip/Tooltip.tsx |
Added Escape key handler to close focus-triggered tooltips |
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx |
Added aria-label to anchor links, aria-labelledby to headings, and aria-hidden/focusable to icon SVG |
frontend/lib/src/components/shared/StreamlitMarkdown/Heading.test.tsx |
Updated test to verify accessible name of anchor links |
e2e_playwright/st_markdown_test.py |
Added E2E test for keyboard focus on markdown heading anchor icons |
e2e_playwright/st_heading_test.py |
Added E2E test for keyboard focus and updated CSS assertions (opacity vs visibility) |
e2e_playwright/shared/app_utils.py |
Added tab_until_focused utility function for resilient keyboard navigation testing |
e2e_playwright/__snapshots__/linux/st_heading_test/*.png |
Updated snapshots to reflect visual changes from CSS modifications |
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx
Outdated
Show resolved
Hide resolved
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx
Show resolved
Hide resolved
📉 Frontend coverage change detectedThe frontend unit test (vitest) coverage has decreased by 0.0000%
✅ Coverage change is within normal range. |
8058013 to
8eeeed6
Compare
096a34d to
5678480
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 14 changed files in this pull request and generated 1 comment.
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx
Outdated
Show resolved
Hide resolved
8eeeed6 to
92962c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 14 changed files in this pull request and generated 3 comments.
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx
Outdated
Show resolved
Hide resolved
92962c4 to
8f4981c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 15 changed files in this pull request and generated 2 comments.
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.test.tsx
Show resolved
Hide resolved
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx
Outdated
Show resolved
Hide resolved
📉 Python coverage change detectedThe Python unit test coverage has decreased by 0.0048%
✅ Coverage change is within normal range. Coverage by files
|
SummaryThis PR improves keyboard accessibility for Markdown/Heading anchor links and related tooltip behavior by making anchor icons keyboard focusable/visible on focus, stabilizing heading accessible names via Code Quality
Test Coverage
Overall: tests cover the new behaviors well, but I’d like the tooltip Escape semantics adjusted (and tests updated accordingly). Backwards Compatibility
Security & Risk
Recommendations
VerdictCHANGES REQUESTED: Core accessibility intent is strong, but the current Escape handling for focus-triggered tooltips removes focus from the trigger, which is likely a keyboard UX regression. This is an automated AI review. Please verify the feedback and use your judgment. |
8f4981c to
970be49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 13 changed files in this pull request and generated 2 comments.
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx
Outdated
Show resolved
Hide resolved
970be49 to
b9ebcd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 13 changed files in this pull request and generated no new comments.
5678480 to
11d03f4
Compare
a97d86d to
13c6d1e
Compare
13c6d1e to
2b8e1d2
Compare
11d03f4 to
7af8313
Compare
2b8e1d2 to
8a2c991
Compare
mayagbarnes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8a2c991 to
c1661f5
Compare
c1661f5 to
2e5419f
Compare
Merge activity
|





Describe your changes
tab_until_focusedutility for more resilient keyboard navigation e2e tests.Escapekey properly dismisses tooltips when focus-triggered.Screenshot or video (only for visual changes)
In this video I am tabbing through the Markdown header links. I use the enter key once and I use shift-tab to go backwards as well:
Kapture.2025-12-16.at.15.13.56.mp4
GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.