Skip to content

Conversation

@sfc-gh-bnisco
Copy link
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Dec 12, 2025

Describe your changes

  • This just reduces copy/paste by centralizing our styling for focus ring.
  • No functional/visual changes in this PR.

GitHub Issue Link (if applicable)

Testing Plan

  • Added unit tests.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Contributor

snyk-io bot commented Dec 12, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Collaborator Author

sfc-gh-bnisco commented Dec 12, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13340/streamlit-1.52.1-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13340.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-bnisco sfc-gh-bnisco added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Dec 12, 2025
@sfc-gh-bnisco sfc-gh-bnisco changed the title [feat] Improve accessibility of Tooltips and Markdown [WIP] [feat] Improve accessibility of Tooltips and Markdown Dec 12, 2025
Copy link
Contributor

Copilot AI left a 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 pull request significantly improves the accessibility of tooltip icons and markdown heading anchor links across the Streamlit application. The changes introduce keyboard navigation support for help tooltips and anchor links, add proper ARIA labels, and fix HTML structure issues related to nested labels.

Key Changes

  • Tooltip icons are now keyboard-focusable with a button wrapper and proper ARIA labels
  • Markdown heading anchor links are accessible via keyboard with visibility improvements using opacity instead of the visibility CSS property
  • Fixed nested <label> element issues by changing StyledWidgetLabelHelpInline from a label to a span element

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/lib/src/components/shared/TooltipIcon/TooltipIcon.tsx Refactored TooltipIcon to render a focusable button with mandatory aria-label, added getHelpTooltipAriaLabel helper function, and enforced type safety via discriminated union
frontend/lib/src/components/shared/TooltipIcon/styled-components.ts Added StyledTooltipTriggerButton with focus-visible styles and updated CSS selector for SVG styling
frontend/lib/src/components/shared/TooltipIcon/TooltipIcon.test.tsx Added tests for keyboard focus, blur behavior, Escape key handling, and aria-label normalization
frontend/lib/src/components/shared/Tooltip/Tooltip.tsx Implemented Escape key handler to dismiss focus-triggered tooltips by blurring the active element
frontend/lib/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx Added aria-label to heading anchor links and aria-hidden to decorative SVG icons
frontend/lib/src/components/shared/StreamlitMarkdown/styled-components.ts Changed anchor link visibility from visibility: hidden to opacity: 0 with pointerEvents: none to keep links in tab order, added focus-within styles
frontend/lib/src/components/shared/StreamlitMarkdown/Heading.test.tsx Updated test assertions for accessible anchor links
frontend/lib/src/components/widgets/BaseWidget/WidgetLabel.tsx Wrapped label text in aria-hidden span while keeping children (help icons) accessible
frontend/lib/src/components/widgets/BaseWidget/WidgetLabelHelpIconInline.tsx Created new wrapper component to consolidate inline help icon usage with proper aria-label handling
frontend/lib/src/components/widgets/BaseWidget/styled-components.ts Changed StyledWidgetLabelHelpInline from label to span to prevent nested label elements
frontend/lib/src/components/widgets/BaseWidget/index.ts Exported new WidgetLabelHelpIconInline component
frontend/lib/src/components/widgets/BaseWidget/WidgetLabel.test.tsx Added tests verifying help icons remain accessible and no nested labels are rendered
Widget files (TimeInput, TextInput, TextArea, Slider, NumberInput, Multiselect, FileUploader, DateTimeInput, DateInput, CameraInput, AudioInput) Updated TooltipIcon usage to include getHelpTooltipAriaLabel(element.label) for proper ARIA labeling
frontend/lib/src/components/widgets/Checkbox/Checkbox.tsx Migrated from StyledWidgetLabelHelpInline + TooltipIcon to WidgetLabelHelpIconInline component
frontend/lib/src/components/widgets/ButtonGroup/ButtonGroup.tsx Migrated to WidgetLabelHelpIconInline component
frontend/lib/src/components/widgets/ChatInput/fileUpload/ChatFileUploadButton.tsx Added aria-label to BaseButton wrapped by TooltipIcon
frontend/lib/src/components/shared/Radio/Radio.tsx Migrated to WidgetLabelHelpIconInline component
frontend/lib/src/components/shared/Dropdown/Selectbox.tsx Added getHelpTooltipAriaLabel(label) to TooltipIcon
frontend/lib/src/components/shared/BaseColorPicker/BaseColorPicker.tsx Migrated to WidgetLabelHelpIconInline component
frontend/lib/src/components/elements/Metric/Metric.tsx Migrated to WidgetLabelHelpIconInline component
e2e_playwright/st_slider_test.py Added test for keyboard-accessible help tooltip
e2e_playwright/st_markdown_test.py Added test for keyboard-focusable and visible anchor icons
e2e_playwright/st_heading_test.py Added test for keyboard-accessible anchor icons and updated CSS property assertions from visibility to opacity
e2e_playwright/shared/app_utils.py Added tab_until_focused utility function for resilient keyboard navigation testing

@sfc-gh-bnisco sfc-gh-bnisco force-pushed the 12-12-_feat_improve_accessibility_of_tooltips_and_markdown branch 4 times, most recently from 78303c9 to 4685cd8 Compare December 12, 2025 21:57
@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

📈 Frontend coverage change detected

The frontend unit test (vitest) coverage has increased by 0.0100%

  • Current PR: 86.3500% (12618 lines, 1722 missed)
  • Latest develop: 86.3400% (12614 lines, 1722 missed)

✅ Coverage change is within normal range.

📊 View detailed coverage comparison

@sfc-gh-bnisco sfc-gh-bnisco force-pushed the 12-12-_feat_improve_accessibility_of_tooltips_and_markdown branch 5 times, most recently from dae7b87 to 096a34d Compare December 16, 2025 04:38
@sfc-gh-bnisco sfc-gh-bnisco changed the title [WIP] [feat] Improve accessibility of Tooltips and Markdown [refactor] Centralize focus ring styling Dec 16, 2025
@sfc-gh-bnisco sfc-gh-bnisco added change:refactor PR contains code refactoring without behavior change impact:internal PR changes only affect internal code and removed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Dec 16, 2025
Copy link
Contributor

Copilot AI left a 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 9 changed files in this pull request and generated 3 comments.

@sfc-gh-bnisco sfc-gh-bnisco force-pushed the 12-12-_feat_improve_accessibility_of_tooltips_and_markdown branch from 096a34d to 5678480 Compare December 16, 2025 05:06
Copy link
Contributor

Copilot AI left a 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 9 changed files in this pull request and generated no new comments.

@sfc-gh-bnisco sfc-gh-bnisco marked this pull request as ready for review December 17, 2025 00:56
@sfc-gh-bnisco sfc-gh-bnisco force-pushed the 12-12-_feat_improve_accessibility_of_tooltips_and_markdown branch from 5678480 to 11d03f4 Compare December 17, 2025 16:48
@sfc-gh-bnisco sfc-gh-bnisco merged commit 7af8313 into develop Dec 17, 2025
43 of 44 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the 12-12-_feat_improve_accessibility_of_tooltips_and_markdown branch December 17, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:refactor PR contains code refactoring without behavior change impact:internal PR changes only affect internal code security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants