Skip to content

fix(button): prioritize disabled state over hover state#59

Merged
prescottprue merged 1 commit intoprescottprue:mainfrom
malashevskyi:fix/hover-disabled-conflict
Jan 13, 2026
Merged

fix(button): prioritize disabled state over hover state#59
prescottprue merged 1 commit intoprescottprue:mainfrom
malashevskyi:fix/hover-disabled-conflict

Conversation

@malashevskyi
Copy link
Contributor

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 the hovered condition before the disabled condition.

Reproduction

Live example on CodeSandbox

Steps to reproduce:

  1. Hover over the Google button (second button)
  2. Click it while hovering
  3. Notice the button displays hover styles instead of disabled styles
  4. Compare with the "Toggle disabled" button which works correctly

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 disabled state over hovered state. This ensures disabled styles are always applied when the button is disabled.

@malashevskyi
Copy link
Contributor Author

@prescottprue
Hi! Would appreciate your feedback when you have time

Copy link
Owner

@prescottprue prescottprue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find! I really appreciate the super clear reproduction as well as the ping to take a look 👏

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@69d76ce). Learn more about missing BASE report.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@prescottprue prescottprue merged commit 18c212f into prescottprue:main Jan 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants