Skip to content

bug: --background-hover being overridden on ion-button fill="clear" and color #23441

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

Closed
reed-lawrence opened this issue Jun 10, 2021 · 4 comments · Fixed by #23442
Closed

bug: --background-hover being overridden on ion-button fill="clear" and color #23441

reed-lawrence opened this issue Jun 10, 2021 · 4 comments · Fixed by #23442
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@reed-lawrence
Copy link

reed-lawrence commented Jun 10, 2021

Ionic version:
"@ionic/core": "^5.6.9"
"@ionic/angular": "^5.6.9"
"@angular/core": "~10.0.0"

Current behavior:
<ion-button fill="clear" style="--background-hover: transparent; --background-hover-opacity: 0;">

Hovered ion-buttons still show a background.

Screen Shot 2021-06-10 at 8 55 21 AM

Chrome inspector shows:
Screen Shot 2021-06-10 at 8 43 45 AM

Which digging through the node_modules:
node_modules/@ionic/core/dist/collection/components/button/button.md.css

Line 417:

@media (any-hover: hover) {
  :host(.button-solid.ion-color:hover) .button-native::after {
    background: var(--ion-color-contrast);
    opacity: 0.08;
  }

  :host(.button-clear.ion-color:hover) .button-native::after,
:host(.button-outline.ion-color:hover) .button-native::after {
    background: var(--ion-color-base);
    opacity: 0.04;
  }
}

Which looks to be a compiled output from here: https://github.com/ionic-team/ionic-framework/blob/master/core/src/components/button/button.md.scss

Expected behavior:
On a desktop application (untested on mobile):

The above styles would expect the button to not have a background when hovered.

@ionitron-bot ionitron-bot bot added the triage label Jun 10, 2021
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Jun 10, 2021
@liamdebeasi liamdebeasi changed the title bug: --background-hover being overridden on ion-button fill="clear" bug: --background-hover being overridden on ion-button fill="clear" and color Jun 10, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. Can you try the following dev build and let me know if it resolves the issue?

npm install @ionic/angular@5.7.0-dev.202106101429.1720014

@reed-lawrence
Copy link
Author

Yep, looks like it did the trick! Confirmed in inspector too:

Screen Shot 2021-06-10 at 9 57 42 AM

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #23442, and a fix will be available in an upcoming release of Ionic Framework.

One change I made to the PR is that you should not be able to override the background color with variables when using the color prop, since that would defeat the purpose of using the color prop. For your use case, that should not make a difference since you can still change the opacity using variables like --background-hover-opacity.

liamdebeasi added a commit that referenced this issue Jun 21, 2021
@ionitron-bot
Copy link

ionitron-bot bot commented Jul 21, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
2 participants