Skip to content

fix: apply button hover states only on supported devices#21724

Merged
sangeethababu9223 merged 8 commits into
carbon-design-system:mainfrom
devadula-nandan:fix/remove-button-hover-states-on-touch
Apr 16, 2026
Merged

fix: apply button hover states only on supported devices#21724
sangeethababu9223 merged 8 commits into
carbon-design-system:mainfrom
devadula-nandan:fix/remove-button-hover-states-on-touch

Conversation

@devadula-nandan

@devadula-nandan devadula-nandan commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Closes #17260

Apply hover states for button only for devices that support it. (non touch devices)
Hover state shouldn't exist necessarily on touch devices as per the citation

https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/hover

Note

this will also effect all other buttons by removing hover state on touch devices. which still makes sense to me.

references
tertiary button states

Changelog

Changed

  • button mixin update

Testing / Reviewing

can be tested on mobile screen mode in dev tools.
can be tested on mobile phones as below

after and before

ScreenRecording_03-06-2026.18-21-23_1.MP4

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
    - [ ] Updated documentation and storybook examples
    - [ ] Wrote passing tests that cover this change
    - [ ] Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@netlify

netlify Bot commented Mar 6, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit bf8f7cd
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/69c1682c710cc80008290a36
😎 Deploy Preview https://deploy-preview-21724--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 6, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit bf8f7cd
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/69c1682c6a922900071bffab
😎 Deploy Preview https://deploy-preview-21724--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@devadula-nandan devadula-nandan marked this pull request as ready for review March 6, 2026 13:08
@devadula-nandan devadula-nandan requested a review from a team as a code owner March 6, 2026 13:08
@codecov

codecov Bot commented Mar 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.39%. Comparing base (b4297c5) to head (bf8f7cd).
⚠️ Report is 121 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21724      +/-   ##
==========================================
+ Coverage   87.75%   94.39%   +6.64%     
==========================================
  Files         536      536              
  Lines       43637    43673      +36     
  Branches     6725     6244     -481     
==========================================
+ Hits        38293    41227    +2934     
+ Misses       5193     2307    -2886     
+ Partials      151      139      -12     
Flag Coverage Δ
main-packages 87.84% <ø> (-0.10%) ⬇️
web-components 97.80% <ø> (+10.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@devadula-nandan

Copy link
Copy Markdown
Contributor Author

not sure if we have to loop design on this 🤔

@devadula-nandan

devadula-nandan commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

hey @tay1orjones,

do u think this convention needs to be in style.md ?
or is there any way to tell sass to pre-compile all hover styles to media hover supported hover styles?

this issue is on button for now but, all other components hover state can benefit from it, which looks like a standard to me, when i compared several components elsewhere.

Comment thread packages/styles/scss/components/button/_mixins.scss
@devadula-nandan

Copy link
Copy Markdown
Contributor Author

@carbon-design-system/design this needs a design validation on buttons for all the 3 states in both desktop and mobile

💻 desktop
first half this pr changes
second half live storybook as is.

desktop.mov

📱 mobile
first half this pr changes
second half live storybook as is.

mobile.mov

@devadula-nandan

Copy link
Copy Markdown
Contributor Author

question to design
do we show button background on focus for
danger-tertiary, tertiary ?

@alina-jacob alina-jacob left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM for the implemented buttons! 🚀
You can go ahead and implement it for Danger button scenarios as well!

It will also be good if you could create an Epic that eventually covers this implementation for other components that fundamentally have a button role / interaction. Here are a few that come to mind:

  • Accordion
  • AI label
  • Code snippet buttons
  • Content switcher
  • Data table toolbar buttons
  • Data table rows (?)
  • Date picker calendar buttons
  • File uploader buttons
  • Link (?)
  • Menu buttons (Menu button, Combo button, Overflow menu button)
  • Menu items of Menu (?)
  • Modal buttons
  • Notification buttons
  • Pagination
  • Pagination Nav
  • Password input
  • Popover
  • Progress indicator
  • Slider (?)
  • Structured list rows (?)
  • Tabs
  • Tags
  • Tile
  • Tree view (?)
  • UI shell header items
  • UI shell left and right nav items

Considering that this is a sev 3 issue, we can also mark it as a community project.

Comment thread packages/styles/scss/components/button/_mixins.scss Outdated

@tay1orjones tay1orjones left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Getting rid of the 'sticky hover' thing that can happen with touch is a good improvement. I think it's worth the risk of potential downstream impacts. In the unlikely event that it's disruptive this is a small change, easily revert-able.

@adamalston adamalston left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can go ahead and implement it for Danger button scenarios as well!

It will also be good if you could create an Epic that eventually covers this implementation for other components that fundamentally have a button role / interaction.

Were these two points from #21724 (review) addressed?

@devadula-nandan

devadula-nandan commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

You can go ahead and implement it for Danger button scenarios as well!
It will also be good if you could create an Epic that eventually covers this implementation for other components that fundamentally have a button role / interaction.

Were these two points from #21724 (review) addressed?

created the issue. the danger hover states are already addressed.

@alina-jacob alina-jacob left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks for working on this @devadula-nandan! 🚀

@sangeethababu9223 sangeethababu9223 added this pull request to the merge queue Apr 16, 2026
Merged via the queue into carbon-design-system:main with commit 2d4cb70 Apr 16, 2026
38 checks passed
MarianaAa01 pushed a commit to MarianaAa01/carbon that referenced this pull request May 29, 2026
…gn-system#21724)

* fix: apply button hover states only on supported devices

* chore: move comment above media

* chore: update copyright year

* fix: review comments

* fix: more cases on mobile

* chore: update hover to any-hover to support hybrid setups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Carbon Ghost button styling issue

5 participants