fix: href in ActionListLinkItem not working inside TopBar+ActionMenu#2256
Open
chornonoh-vova wants to merge 3 commits intodevelopfrom
Open
fix: href in ActionListLinkItem not working inside TopBar+ActionMenu#2256chornonoh-vova wants to merge 3 commits intodevelopfrom
chornonoh-vova wants to merge 3 commits intodevelopfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where href attributes in ActionListLinkItem components were not working when used inside a TopBar+ActionMenu pattern. The issue was that the menu would close prematurely when clicking a link, preventing navigation.
Changes:
- Enhanced blur event handling in
ActionMenuto prevent premature closing when clicking links - Added comprehensive test coverage for link navigation and focus management
- Included test cleanup to prevent test pollution
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/react/src/components/ActionMenu/ActionMenu.tsx | Modified handleOverlayBlur to check if focus remains within the overlay or moves to the trigger before closing the menu |
| packages/react/src/components/ActionMenu/ActionMenu.test.tsx | Added afterEach cleanup for window.location.hash and two new tests verifying link navigation and focus behavior |
| packages/react/src/components/ActionList/ActionListItem.tsx | Formatting-only change breaking the interface declaration across multiple lines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
maksym-shynkarenko
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Action menu links not navigating when clicked
Problem
ActionListLinkItemelements inside anActionMenuwere not navigating to theirhrefwhen clicked. TheonBlurhandler added toAnchoredOverlaywould fire before the click event could complete, closing the menu and removing the link from the DOM.Solution
Updated
handleOverlayBlurto checkevent.relatedTargetbefore deciding whether to close the menu:handleTriggerClickhandle closing, preventing a double-close that was causing the menu to re-open and navigate to the first linkTesting
Added two new tests to cover the affected scenarios:
ActionListLinkItemnavigates to the correcthref