Skip to content

fix(ui-tooltip,ui-popover): put aria-expanded on trigger element#1965

Merged
HerrTopi merged 1 commit into
masterfrom
add-aria-expanded
Jun 13, 2025
Merged

fix(ui-tooltip,ui-popover): put aria-expanded on trigger element#1965
HerrTopi merged 1 commit into
masterfrom
add-aria-expanded

Conversation

@HerrTopi

@HerrTopi HerrTopi commented May 8, 2025

Copy link
Copy Markdown
Contributor

INSTUI-4544

@HerrTopi HerrTopi requested a review from Copilot May 8, 2025 14:58

This comment was marked as outdated.

@HerrTopi HerrTopi force-pushed the add-aria-expanded branch from f21f1f7 to 0057bea Compare May 9, 2025 08:24
@github-actions

github-actions Bot commented May 9, 2025

Copy link
Copy Markdown
PR Preview Action v1.6.1

🚀 View preview at
https://instructure.design/pr-preview/pr-1965/

Built to branch gh-pages at 2025-06-13 12:22 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copilot AI left a comment

Copy link
Copy Markdown

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 introduces a new shouldSetARIAExpanded prop to Popover and Drilldown components to control whether aria-expanded is applied to their trigger elements, and disables it for a hidden submenu in the top nav bar.

  • Add shouldSetARIAExpanded prop (default true) in Popover and Drilldown props
  • Update Popover and Drilldown render logic to conditionally apply aria-expanded
  • Pass shouldSetARIAExpanded={false} for hidden Drilldown in TopNavBarMenuItems

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/ui-top-nav-bar/src/TopNavBar/TopNavBarMenuItems/index.tsx Disable aria-expanded on hidden Drilldown trigger
packages/ui-popover/src/Popover/props.ts Define new shouldSetARIAExpanded prop
packages/ui-popover/src/Popover/index.tsx Default prop, destructuring cleanup, conditional aria-expanded
packages/ui-drilldown/src/Drilldown/props.ts Define new shouldSetARIAExpanded prop
packages/ui-drilldown/src/Drilldown/index.tsx Default prop, pass-through to Popover, trigger aria-expanded
Comments suppressed due to low confidence (1)

packages/ui-popover/src/Popover/index.tsx:472

  • [nitpick] Consider adding unit tests or integration tests to verify that aria-expanded is correctly set or omitted on the trigger based on shouldSetARIAExpanded and the Popover's open/close state.
if (this.props.shouldSetARIAExpanded) {

Comment thread packages/ui-drilldown/src/Drilldown/index.tsx Outdated
@HerrTopi HerrTopi force-pushed the add-aria-expanded branch from 3c1a1f9 to 623ed76 Compare June 11, 2025 17:29

@matyasf matyasf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

see my comments

Comment thread packages/ui-drilldown/src/Drilldown/index.tsx Outdated
Comment thread packages/ui-popover/src/Popover/props.ts Outdated
Comment thread packages/ui-popover/src/Popover/index.tsx Outdated
Comment thread packages/ui-drilldown/src/Drilldown/index.tsx Outdated
@HerrTopi HerrTopi force-pushed the add-aria-expanded branch from 623ed76 to 2ae6f69 Compare June 13, 2025 09:27
@HerrTopi HerrTopi requested a review from matyasf June 13, 2025 09:29

@matyasf matyasf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work! Please add a more detailed commit message, and then its good to go

…xpanded, allow override with shouldSetAriaExpanded

This change adds a new prop (shouldSetAriaExpanded) to Popover and Drilldown as well. It defaults to true. It is needed for setting automatically the aria-expanded attribute on the DOM. This can have a side-effect of duplicating aria-expanded in certain edge cases or putting aria-expanded on triggers where it doesn't need to be there. These are very rare cases so we decided to have "break" these cases and fix all the orher ones where aria-expanded was missing

INSTUI-4544
@HerrTopi HerrTopi force-pushed the add-aria-expanded branch from 2ae6f69 to abf8598 Compare June 13, 2025 12:17
@HerrTopi HerrTopi merged commit b8e1367 into master Jun 13, 2025
6 of 7 checks passed
@HerrTopi HerrTopi deleted the add-aria-expanded branch June 13, 2025 12:17
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.

4 participants