PopoverPrimitive - Add onFocusOut argument#3571
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
31fa96f to
238df6d
Compare
5 tasks
238df6d to
002f184
Compare
Member
Contributor
Author
002f184 to
f01601b
Compare
4 tasks
d995e4c to
d1dc360
Compare
d1dc360 to
6c11ac9
Compare
3 tasks
shleewhite
previously approved these changes
Mar 2, 2026
showcase/app/components/page-utilities/popover-primitive/sub-sections/demos.gts
Outdated
Show resolved
Hide resolved
shleewhite
approved these changes
Mar 3, 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.
📌 Summary
If merged, this PR would add a
onFocusOutargument to thePopoverPrimitiveand add it as well to the following components which use thePopoverPrimitive.DropdownFilterBarActionsDropdownFiltersDropdownRichTooltipPopoverPrimitive demo
FilterBar demo
🛠️ Detailed description
Originally raised in an instance of the
FilterBar, it was observed that if the content of aPopoverPrimitivehas content that changes dynamically, there are certain situations where the popover is closing automatically when the content changes, even if that is not the desired behavior.The cause of this issue is related to when the element that is focused is removed from the DOM. When this occurs currently the
PopoverPrimitive'sonFocusOutaction is called, and the popover is automatically closed if focus is not inside the popover. This existing behavior causes two issues.To solve this issue an
onFocusOutargument has been added to thePopoverPrimitive. When present, if the focus leaves the popover (which would occur if the element with focus is removed), the consumer can use the callback to direct the focus to another element in the popover and the popover is not closed. If focus moves out of the popover to another element on the page the popover is still closed automatically as is the case currently.This argument has been additionally added to other components that use the
PopoverPrimitive.Native PopoverAPI
The
PopoverPrimitiveuses the native Popover API to display the content. The API does not close all popovers automatically when focus is lost. There could be situations for a11y purposes where the popover should remain open on focus loss, or situations where it should close. OurPopoverPrimitiveis built to always close on focus out, so to continue that behavior this argument is needed for the use cases when the popover should not close on focus out. The Popover api does not provide any native callback that can be used to handle how focus is lost.📸 Screenshots
PopoverPrimitive
Before
Screen.Recording.2026-02-09.at.11.29.49.AM.mov
After
onFocusOutcallback is triggered in thePopoverPrimitiveScreen.Recording.2026-02-09.at.11.28.39.AM.mov
FilterBar
Before
Screen.Recording.2026-02-09.at.11.32.50.AM.mov
After
Screen.Recording.2026-02-09.at.11.31.03.AM.mov
🔗 External links
Jira ticket: HDS-5997
Figma file: [if it applies]
👀 Component checklist
💬 Please consider using conventional comments when reviewing this PR.
📋 PCI review checklist
Examples of changes to controls include access controls, encryption, logging, etc.
Examples include changes to operating systems, ports, protocols, services, cryptography-related components, PII processing code, etc.