fix(button): prioritize disabled state over hover state#59
Merged
prescottprue merged 1 commit intoprescottprue:mainfrom Jan 13, 2026
Merged
Conversation
Contributor
Author
|
@prescottprue |
prescottprue
approved these changes
Jan 13, 2026
Owner
prescottprue
left a comment
There was a problem hiding this comment.
Great find! I really appreciate the super clear reproduction as well as the ping to take a look 👏
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #59 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 5
Lines ? 48
Branches ? 0
========================================
Hits ? 48
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Description
Fixes a bug where hover styles conflict with disabled styles when the button becomes disabled while being hovered.
Problem
Currently, when a button is clicked and becomes disabled while the mouse is still hovering over it, the hover styles take precedence over disabled styles. This happens because
getStyle()checks thehoveredcondition before thedisabledcondition.Reproduction
Live example on CodeSandbox
Steps to reproduce:
Expected behavior: Button should display disabled styles when disabled, regardless of hover state.
Actual behavior: Button displays hover styles when disabled while being hovered.
Solution
Reorder the conditional checks to prioritize
disabledstate overhoveredstate. This ensures disabled styles are always applied when the button is disabled.