fix(theme): bordered focus styles take precedence over hover#5893
Conversation
🦋 Changeset detectedLatest commit: 0d704eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 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 |
|
@hasegawa-101 is attempting to deploy a commit to the HeroUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughAdds compound Tailwind selectors to bordered variants in Input, NumberInput, and Select theme components so focus border styles apply when both focus and hover are active. Converts some Changes
Sequence Diagram(s)(omitted — changes are styling/class composition only; no runtime/control-flow changes to diagram) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (3)
Tip 📝 Customizable high-level summaries are now available!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
wingkwong
left a comment
There was a problem hiding this comment.
could you please also paste the storybook code of your demonstration here.
const Issue5585Template = (args) => {
return (
<div className="w-full max-w-6xl space-y-8">
<div>
<div className="space-y-8">
<div>
<h4 className="text-md font-semibold mb-4">Before vs After Comparison</h4>
<div className="grid grid-cols-2 gap-8">
{/* Before Fix - Simulating the bug */}
<div className="space-y-4">
<h5 className="text-sm font-semibold text-danger mb-2">❌ Before Fix (Bug)</h5>
<p className="text-xs text-default-400 mb-4">
Hover styles override focus styles - border stays light
</p>
<Input
{...args}
color="default"
label="Default (Before)"
placeholder="Hover then focus"
variant="bordered"
/>
<Input
{...args}
color="primary"
label="Primary (Before)"
placeholder="Hover then focus"
variant="bordered"
/>
<Input
{...args}
color="danger"
label="Danger (Before)"
placeholder="Hover then focus"
variant="bordered"
/>
</div>
{/* After Fix - Default behavior */}
<div className="space-y-4">
<h5 className="text-sm font-semibold text-success mb-2">✅ After Fix (Correct)</h5>
<p className="text-xs text-default-400 mb-4">
Focus styles take precedence - border becomes dark
</p>
<Input
{...args}
classNames={{
inputWrapper:
"group-data-[focus=true]:data-[hover=true]:border-default-foreground",
}}
color="default"
label="Default (After)"
placeholder="Hover then focus"
variant="bordered"
/>
<Input
{...args}
classNames={{
inputWrapper: "group-data-[focus=true]:data-[hover=true]:border-primary",
}}
color="primary"
label="Primary (After)"
placeholder="Hover then focus"
variant="bordered"
/>
<Input
{...args}
classNames={{
inputWrapper: "group-data-[focus=true]:data-[hover=true]:border-danger",
}}
color="danger"
label="Danger (After)"
placeholder="Hover then focus"
variant="bordered"
/>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
export const Issue5585HoverFocusPrecedence = {
render: Issue5585Template,
args: {
...defaultProps,
},
};`Here is the code to reproduce this in Storybook. Please check it on the canary branch. |
@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 #5585
📝 Description
Fixed bordered Input, NumberInput, and Select components where hover styles were taking precedence over focus styles, making it difficult to see the focus state when hovering and clicking on the input.
⛳️ Current behavior (updates)
When clicking on a bordered input/select component while hovering:
This caused accessibility issues as users couldn't see the focus state clearly when interacting with the component using a mouse.
🚀 New behavior
group-data-[focus=true]:data-[hover=true]:border-*classes to ensure focus styles win in the specificity battleborderedvariantThe fix ensures proper visual feedback for all interaction states, improving accessibility.
2025-11-11.13.55.49.mov
💣 Is this a breaking change (Yes/No):
No
📝 Additional Information
This fix applies to all color variants (default, primary, secondary, success, warning, danger) of the bordered style. Keyboard navigation (tab key focus) was already working correctly in v2.8.2.
Summary by CodeRabbit