Skip to content

fix(ui-top-nav-bar): fix focus ring not showing when closing a dropdown#2020

Merged
matyasf merged 1 commit into
masterfrom
topnav_focus_fix
Jun 13, 2025
Merged

fix(ui-top-nav-bar): fix focus ring not showing when closing a dropdown#2020
matyasf merged 1 commit into
masterfrom
topnav_focus_fix

Conversation

@matyasf

@matyasf matyasf commented Jun 12, 2025

Copy link
Copy Markdown
Collaborator

The issue was likely that TopNavBarItem did not enter the focused state because its rerendered a lot. This fix does not use the onFocus React event rather sets withFocusoutline to undefined so the focus ring is added via CSS

This PR also fixes a strange build error, that checkTSReferences was failing with a JSON parse error.

To test: Check the TopNavBar examples. Menu items should be in focus when their dropdown is open and when it gets closed (e.g. by pressing ESC)

Fixes INSTUI-4587

The issue was likely that TopNavBarItem did not enter the focused state because its rerendered a
lot. This fix does not use the onFocus React event rather sets withFocusoutline to undefined so the
focus ring is added via CSS

Fixes INSTUI-4587
@matyasf matyasf self-assigned this Jun 12, 2025
@matyasf matyasf requested a review from Copilot June 12, 2025 20:16

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 fixes a focus ring issue in TopNavBarItem by adjusting the logic to set withFocusOutline appropriately and resolves a JSON parse error in tsconfig.build.json.

  • Refactored focus ring logic in TopNavBarItem to remove state-based focus and use a ternary operator.
  • Removed the trailing comma in tsconfig.build.json to avoid JSON parsing errors.

Reviewed Changes

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

File Description
packages/ui-top-nav-bar/src/TopNavBar/TopNavBarItem/index.tsx Refactored withFocusOutline logic to conditionally set the focus ring value
packages/ui-color-utils/tsconfig.build.json Removed trailing comma to fix JSON parse error

@github-actions

github-actions Bot commented Jun 12, 2025

Copy link
Copy Markdown
PR Preview Action v1.6.1
Preview removed because the pull request was closed.
2025-06-13 09:53 UTC

@instructure instructure deleted a comment from Copilot AI Jun 12, 2025
@matyasf matyasf requested review from ToMESSKa and joyenjoyer June 12, 2025 20:47

@joyenjoyer joyenjoyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

gj

@matyasf matyasf merged commit 051eca7 into master Jun 13, 2025
11 checks passed
@matyasf matyasf deleted the topnav_focus_fix branch June 13, 2025 09:52
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