From 68c0e7136d3f8aad8a195a0371104f7dd5fa7060 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Mon, 21 Jun 2021 13:00:50 -0400 Subject: [PATCH] fix(button): buttons using fill and color properties now account for hover and focused opacity variables (#23442) resolves #23441 --- core/src/components/button/button.md.scss | 15 ++++---- .../components/button/test/outline/index.html | 1 + .../components/button/test/states/index.html | 36 +++++++++++++++++++ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/core/src/components/button/button.md.scss b/core/src/components/button/button.md.scss index f01520a164..a8493a2dbf 100644 --- a/core/src/components/button/button.md.scss +++ b/core/src/components/button/button.md.scss @@ -129,30 +129,29 @@ // Material Design Button: Hover // -------------------------------------------------- +/** + * Only allow overriding of opacity here + * as developers should not be overriding + * colors when using the color prop. + */ + :host(.button-solid.ion-color.ion-focused) .button-native::after { background: #{current-color(contrast)}; - - opacity: .24; } :host(.button-clear.ion-color.ion-focused) .button-native::after, :host(.button-outline.ion-color.ion-focused) .button-native::after { background: #{current-color(base)}; - - opacity: .12; } + @media (any-hover: hover) { :host(.button-solid.ion-color:hover) .button-native::after { background: #{current-color(contrast)}; - - opacity: .08; } :host(.button-clear.ion-color:hover) .button-native::after, :host(.button-outline.ion-color:hover) .button-native::after { background: #{current-color(base)}; - - opacity: .04; } } diff --git a/core/src/components/button/test/outline/index.html b/core/src/components/button/test/outline/index.html index 27db3c617a..0383bcb93a 100644 --- a/core/src/components/button/test/outline/index.html +++ b/core/src/components/button/test/outline/index.html @@ -90,6 +90,7 @@ Dark.focused Dark.activated.focused

+

Disabled Secondary Disabled diff --git a/core/src/components/button/test/states/index.html b/core/src/components/button/test/states/index.html index acfb1e16fd..9bff07e624 100644 --- a/core/src/components/button/test/states/index.html +++ b/core/src/components/button/test/states/index.html @@ -89,6 +89,31 @@ Outline Clear

+ +
+ Button + Button + Button + +
+ + Button + Button + Button + +
+ + Button + Button + Button + +
+ + Button + Button + Button +
+ @@ -110,6 +135,17 @@ .custom { --color: red; } + + .custom-variables ion-button { + --color: black; + + --background: pink; + --background-focused: red; + --background-hover: green; + + --background-focused-opacity: .5; + --background-hover-opacity: .5; + }