Skip to content

fix(ui-top-nav-bar,ui-drilldown): fix Drilldown's and TopNavBar's key…#1975

Merged
ToMESSKa merged 1 commit intomasterfrom
INSTUI-4494_cred_25_ia_20_floating_window
May 29, 2025
Merged

fix(ui-top-nav-bar,ui-drilldown): fix Drilldown's and TopNavBar's key…#1975
ToMESSKa merged 1 commit intomasterfrom
INSTUI-4494_cred_25_ia_20_floating_window

Conversation

@ToMESSKa
Copy link
Contributor

@ToMESSKa ToMESSKa commented May 15, 2025

…board navigation issues

INSTUI-4494

ISSUES:

  • in Drilldown and TopnavBar, the first option is not focused when the Drilldown is opened with the keyboard
  • the screen reader cannot return focus to the Drilldown trigger when user is on the first item of a Drilldown

TEST PLAN:

with keyboard navigation only (no screenreader):

  • test the 'Admin' menu from the TopNavBar playground
  • when opening the 'Admin" menu, the first option should be focused and highlighted (previously the first item was not highlighted)
  • you should be able to close the menu with ESC and the focus should return to the 'Admin' button
  • test the examples in DrillDown that have a trigger button the same way
  • they should behave the same way as the 'Admin' dropdown (highlighting first available options, returning focus to the triggers)
  • test the SmallViewPort version of the TopNavBar playground too, it should behave the same way (highlighting first avaliable option, returning focus to the trigger)

with VoiceOver:

  • test the 'Admin' menu from the TopNavBar playground
  • when opening the 'Admin" menu with Control + Options + Tab (or your custom VoiceOver command), the first option should be focused (previously the first item was not focused)
  • you should be able navigate through the options with Control + Options + Right Arrow/Left Arrow
  • When the focus is on the first item, keep pressing Control + Options + Left Arrow, you should be able to move back to the admin button (previously the focus jumped to the end of the page because the menu was mounted at the end of the document)
  • test the examples in DrillDown that have a trigger button the same way
  • they should behave the same way as the 'Admin' dropdown (focusing the first available option, returning focus to the triggers)
  • test the SmallViewPort version of the TopNavBar playground too, it should behave the same way (focusing the first available option, returning focus to the trigger)

with JAWS/NVDA:

  • test the 'Admin' menu from the TopNavBar playground
  • when opening the 'Admin" menu with Enter, the first option should be focused (previously the first item was not focused)
  • you should be able navigate through the options with Down Arrow/Up Arrow
  • When the focus is on the first item, keep pressing Up Arrow, you should be able to move back to the admin button (previously the focus jumped to the end of the page because the menu was mounted at the end of the document)
  • test the examples in DrillDown that have a trigger button the same way
  • they should behave the same way as the 'Admin' dropdown (focusing the first available option, returning focus to the triggers)
  • test the SmallViewPort version of the TopNavBar playground too, it should behave the same way (focusing the first available option, returning focus to the trigger)

with iOS VoiceOver:

  • test the 'Admin' menu from the TopNavBar playground and the DrillDown examples with a trigger
  • when opening menu with double tap, the first option should be focused (previously the first item was not focused)
  • you should be able navigate through the options with swipes
  • When the focus is on the first item, swipe left, you should be able to move back to the admin button (previously the focus jumped to the end of the page because the menu was mounted at the end of the document)

@github-actions
Copy link

github-actions bot commented May 15, 2025

PR Preview Action v1.6.1
Preview removed because the pull request was closed.
2025-05-29 14:15 UTC

@ToMESSKa ToMESSKa self-assigned this May 15, 2025
@ToMESSKa ToMESSKa force-pushed the INSTUI-4494_cred_25_ia_20_floating_window branch from 4740d11 to db495b3 Compare May 15, 2025 14:44
}}
onShowContent={(event) => this.handleToggle(event, true)}
mountNode={mountNode}
mountNode={mountNode || this.ref}
Copy link
Contributor Author

@ToMESSKa ToMESSKa May 15, 2025

Choose a reason for hiding this comment

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

This solution is based on mounting the DrillDown to the component (not to document.body), allowing us to navigate back from the first item to the trigger button itself.

Copy link
Collaborator

@matyasf matyasf May 29, 2025

Choose a reason for hiding this comment

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

we should mention this in the release notes, it might break stuff for users

'aria-label': `${item.label} menu`
}}
Copy link
Contributor Author

@ToMESSKa ToMESSKa May 15, 2025

Choose a reason for hiding this comment

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

Réka said "open for" is unnecessary and confusing here.

alignItems: 'stretch',
justifyContent: 'space-between',
height: componentTheme.desktopHeight,
position: 'relative',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these positions and overflows needed to be modified now that Drilldown is no longer mounted to the end of the document, otherwise the styling breaks

@ToMESSKa ToMESSKa requested review from HerrTopi, balzss and Copilot May 15, 2025 15:10
Copy link

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 PR fixes keyboard navigation and focus issues in both the Drilldown and TopNavBar components. Key changes include:

  • Updating style rules (changing overflow properties) to prevent focus ring cropping.
  • Adjusting aria-labels in the TopNavBar to improve accessibility.
  • Modifying Drilldown behavior to focus the first available item on keyboard invocation and improving mountNode handling.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/ui-top-nav-bar/src/TopNavBar/TopNavBarMenuItems/styles.ts Adds 'overflow: visible' to prevent focus ring cropping
packages/ui-top-nav-bar/src/TopNavBar/TopNavBarLayout/DesktopLayout/styles.ts Changes overflow from hidden to visible and removes an unneeded relative positioning
packages/ui-top-nav-bar/src/TopNavBar/README.md Updates aria-label text for better accessibility semantics
packages/ui-drilldown/src/Drilldown/props.ts Updates mount node documentation to reflect new default behavior
packages/ui-drilldown/src/Drilldown/index.tsx Implements keyboard focus handling and adjusts mountNode fallback

as="div"
elementRef={this.handleDrilldownRef}
tabIndex={0}
css={styles?.drilldown}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We no longer need to focus the entire Popover—just the first item—so this part was removed.

@ToMESSKa ToMESSKa marked this pull request as draft May 16, 2025 14:47
@ToMESSKa ToMESSKa force-pushed the INSTUI-4494_cred_25_ia_20_floating_window branch from db495b3 to d4c4b4f Compare May 20, 2025 12:38

{...item.submenu && {
renderSubmenu: this.generateSubmenu(item),
'aria-label': `Open for ${item.label} menu`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Réka said aria-label is unnecessary hin these places and advised to remove them

Comment on lines -610 to -613
{!this.hasBreadcrumbBlock && !trayMountNode && (
<div css={styles?.trayContainer} id={this._trayContainerId} />
)}

Copy link
Contributor Author

@ToMESSKa ToMESSKa May 20, 2025

Choose a reason for hiding this comment

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

I moved this code after line 466 so that when I'm on the first item of the drill-down menu with SR and step back, the focus returns to the Drilldown's trigger, thereby exiting the DrillDown.

Comment on lines +305 to +306
focusFirstAvailableItem(
event?:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this handles the focus in SmallPortView

@ToMESSKa ToMESSKa removed the request for review from balzss May 20, 2025 12:54
@ToMESSKa ToMESSKa marked this pull request as ready for review May 20, 2025 12:55
@ToMESSKa ToMESSKa requested a review from joyenjoyer May 20, 2025 12:55
@joyenjoyer joyenjoyer self-requested a review May 26, 2025 14:40
…avBar's keyboard navigation issues

INSTUI-4494
@ToMESSKa ToMESSKa force-pushed the INSTUI-4494_cred_25_ia_20_floating_window branch from 37aabb7 to 4fe3cea Compare May 28, 2025 14:24
@ToMESSKa ToMESSKa requested a review from matyasf May 29, 2025 07:40
Copy link
Contributor

@HerrTopi HerrTopi left a comment

Choose a reason for hiding this comment

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

Now it seems fine to me. Good work

Copy link
Collaborator

@matyasf matyasf left a comment

Choose a reason for hiding this comment

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

When I use only keyboard in the playground's smallViewport mode and go into the Admin menu, thew whole menu is selected, is this OK?

@ToMESSKa ToMESSKa merged commit 6d7d3fa into master May 29, 2025
8 checks passed
@ToMESSKa ToMESSKa deleted the INSTUI-4494_cred_25_ia_20_floating_window branch May 29, 2025 14:14
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.

5 participants