-
-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(listbox): prevent option focus from start/end content slots #6060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Conversation
non-interactive slot content, and prevented focus leakage from interactive start/end content such as buttons.
🦋 Changeset detectedLatest commit: 65cde6f The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@KumJungMin is attempting to deploy a commit to the HeroUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
@heroui/accordion
@heroui/alert
@heroui/autocomplete
@heroui/avatar
@heroui/badge
@heroui/breadcrumbs
@heroui/button
@heroui/calendar
@heroui/card
@heroui/checkbox
@heroui/chip
@heroui/code
@heroui/date-input
@heroui/date-picker
@heroui/divider
@heroui/drawer
@heroui/dropdown
@heroui/form
@heroui/image
@heroui/input
@heroui/input-otp
@heroui/kbd
@heroui/link
@heroui/listbox
@heroui/menu
@heroui/modal
@heroui/navbar
@heroui/number-input
@heroui/pagination
@heroui/popover
@heroui/progress
@heroui/radio
@heroui/ripple
@heroui/scroll-shadow
@heroui/select
@heroui/skeleton
@heroui/slider
@heroui/snippet
@heroui/spacer
@heroui/spinner
@heroui/switch
@heroui/table
@heroui/tabs
@heroui/toast
@heroui/tooltip
@heroui/user
@heroui/react
@heroui/system
@heroui/system-rsc
@heroui/theme
@heroui/use-aria-accordion
@heroui/use-aria-accordion-item
@heroui/use-aria-button
@heroui/use-aria-link
@heroui/use-aria-modal-overlay
@heroui/use-aria-multiselect
@heroui/use-aria-overlay
@heroui/use-callback-ref
@heroui/use-clipboard
@heroui/use-data-scroll-overflow
@heroui/use-disclosure
@heroui/use-draggable
@heroui/use-form-reset
@heroui/use-image
@heroui/use-infinite-scroll
@heroui/use-intersection-observer
@heroui/use-is-mobile
@heroui/use-is-mounted
@heroui/use-measure
@heroui/use-pagination
@heroui/use-real-shape
@heroui/use-ref-state
@heroui/use-resize
@heroui/use-safe-layout-effect
@heroui/use-scroll-position
@heroui/use-ssr
@heroui/use-theme
@heroui/use-update-effect
@heroui/use-viewport-size
@heroui/aria-utils
@heroui/dom-animation
@heroui/framer-utils
@heroui/react-rsc-utils
@heroui/react-utils
@heroui/shared-icons
@heroui/shared-utils
@heroui/stories-utils
@heroui/test-utils
commit: |
Closes #5551
📝 Description
When a ListboxItem includes interactive elements such as buttons inside
startContentorendContent, clicking those elements could cause focusto unexpectedly move to the first ListboxItem, resulting in incorrect
focus styles being applied.
This PR updates the focus handling logic so that focus events originating
from the start/end content slots are no longer treated as option focus,
preventing unintended focus movement and styling.
⛳️ Current behavior (updates)
startContentorendContentcontains focusable elements (e.g. buttons)useOptionfrom react-aria interprets the bubbled focus as option focus, which:This occurs even though the option itself was not directly interacted with,
but rather an internal interactive element was clicked.
🚀 New behavior
Ideally, focusable descendants should be configurable at the
useOptionlevel.However, since modifying react-aria internals is not feasible, this PR addresses
the issue within HeroUI.
Focus events originating from elements within
data-slot="startContent"ordata-slot="endContent"are no longer treatedas option focus.
Clicking non-interactive elements (e.g.
span,p) inside start/end contentcontinues to apply option focus as before.
Clicking interactive elements such as buttons or links no longer triggers
unintended focus styles or incorrect focus movement.
As a result, ListboxItem focus behavior now correctly reflects the rule:
only direct interactions with the option itself should apply option focus.
2025-12-27.4.45.03.mov
💣 Is this a breaking change (Yes/No):
No
to the previous implementation.
📝 Additional Information
focus propagation at the
onFocusCapturephase.useOption,SelectionManager) cannot bemodified directly, HeroUI conditionally filters focus events at the component level.
in
useOptionin the future, this implementation can be revisited and improved.