Skip to content

fix(button): use proper colors for the button states in the ionic theme #30339

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

Merged
merged 37 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9b25ed0
feat(css): add support for the subtle color map
brandyscarney Mar 26, 2025
2a0fdf3
Merge branch 'next' into FW-6252
brandyscarney Mar 26, 2025
e8605e7
test(theme): skip test because all tests fail on one or more colors
brandyscarney Mar 26, 2025
5391165
chore(): add updated snapshots
Ionitron Mar 26, 2025
19c944a
style: comments
brandyscarney Mar 26, 2025
147550a
Merge branch 'next' into FW-6252
brandyscarney Mar 28, 2025
e13d85d
Merge branch 'next' into FW-6252
brandyscarney Apr 2, 2025
8fc775f
refactor(themes): add foreground color for colors when used as text
brandyscarney Apr 2, 2025
9bfe374
test(theme): use proper color variants
brandyscarney Apr 2, 2025
c814794
fix(button): use correct styles for the focused state and clear color
brandyscarney Apr 3, 2025
caf3c2d
style: lint
brandyscarney Apr 3, 2025
aed941f
test(themes): re-enable tests with correct checks
brandyscarney Apr 3, 2025
e86e9d5
chore(): add updated snapshots
Ionitron Apr 3, 2025
59d713f
revert back to tokens
brandyscarney Apr 3, 2025
6306fe6
style: lint
brandyscarney Apr 3, 2025
a84f282
Merge branch 'next' into FW-6252
brandyscarney Apr 4, 2025
60a241f
fix(themes): add tertiary, remove TODOs
brandyscarney Apr 4, 2025
465a5ef
lint again and again and again
brandyscarney Apr 4, 2025
0806f51
Merge branch 'FW-6252' into FW-6252-button
brandyscarney Apr 4, 2025
517b698
fix(button): button hover should match pressed state
brandyscarney Apr 4, 2025
3187866
chore(): add updated snapshots
Ionitron Apr 4, 2025
8824f20
chore(): add updated snapshots
brandyscarney Apr 4, 2025
3f7d7ff
Merge branch 'FW-6252' into FW-6252-button
brandyscarney Apr 4, 2025
9d9bb79
chore(): add updated snapshots
brandyscarney Apr 4, 2025
75421d3
fix(themes): update other palettes to include foreground
brandyscarney Apr 4, 2025
a73ee18
Merge branch 'FW-6252' into FW-6252-button
brandyscarney Apr 4, 2025
887743a
chore(): add updated snapshots
brandyscarney Apr 4, 2025
eca3566
fix(themes): do not require the foreground variant for ios and md
brandyscarney Apr 7, 2025
67f8334
Merge branch 'next' into FW-6252
brandyscarney Apr 7, 2025
dc2ac02
Merge branch 'FW-6252' into FW-6252-button
brandyscarney Apr 7, 2025
a0f799d
git: revert snapshots
brandyscarney Apr 7, 2025
22ddb4c
fix(css): remove the unused foreground vars
brandyscarney Apr 7, 2025
6d05513
style: comment cleanup
brandyscarney Apr 7, 2025
da4e069
fix(themes): fallback to base if foreground is undefined
brandyscarney Apr 7, 2025
78fe423
Merge branch 'FW-6252' into FW-6252-button
brandyscarney Apr 7, 2025
863b87f
Merge branch 'next' into FW-6252-button
brandyscarney Apr 11, 2025
95b8bbb
Merge branch 'next' into FW-6252-button
brandyscarney Apr 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/components/button/button.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
:host(.button-clear) {
--border-width: 0;
--background: transparent;
--color: #{ion-color(primary, base)};
--color: #{ion-color(primary, foreground)};
}

// Block Button
Expand Down Expand Up @@ -289,7 +289,7 @@ ion-ripple-effect {
// Clear Button with Color
:host(.button-clear.ion-color) .button-native {
background: transparent;
color: current-color(base);
color: current-color(foreground);
}

// Button in Toolbar
Expand Down
38 changes: 18 additions & 20 deletions core/src/components/button/button.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@

:host(.button-solid) {
--background-activated: #{globals.ion-color(primary, shade)};
--background-hover: #{globals.ion-color(primary, contrast)};
--background-focused: #{globals.ion-color(primary, contrast)};
--background-focused-opacity: 0.24;
--background-hover-opacity: 0.08;
--background-hover: #{globals.ion-color(primary, shade)};
--background-focused: transparent;
--background-hover-opacity: 1;
--ripple-opacity: var(--background-activated-opacity, 1);
--ripple-color: var(--background-activated);
}
Expand All @@ -58,10 +57,10 @@
:host(.button-outline) {
--border-width: #{globals.$ion-border-size-025};
--border-style: #{globals.$ion-border-style-solid};
--background-activated: #{globals.$ion-primitives-neutral-200};
--background-activated: #{globals.$ion-bg-neutral-subtlest-press};
--background-focused: transparent;
--background-hover: #{globals.ion-color(primary, base)};
--background-hover-opacity: 0.04;
--background-hover: #{globals.$ion-bg-neutral-subtlest-press};
--background-hover-opacity: 1;
--ripple-opacity: var(--background-activated-opacity, 1);
--ripple-color: var(--background-activated);
}
Expand All @@ -70,10 +69,10 @@
// --------------------------------------------------

:host(.button-clear) {
--background-activated: #{globals.$ion-primitives-neutral-200};
--background-activated: #{globals.$ion-bg-neutral-subtlest-press};
--background-focused: transparent;
--background-hover: #{globals.ion-color(primary, base)};
--background-hover-opacity: 0.04;
--background-hover: #{globals.$ion-bg-neutral-subtlest-press};
--background-hover-opacity: 1;
--ripple-opacity: var(--background-activated-opacity, 1);
--ripple-color: var(--background-activated);
}
Expand Down Expand Up @@ -217,16 +216,6 @@
outline-offset: globals.$ion-border-size-050;
}

/**
* 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: globals.current-color(contrast);
}

// Button: Activated
// --------------------------------------------------

Expand All @@ -239,6 +228,15 @@
background: transparent;
}

// Button: Hover
// --------------------------------------------------

@media (any-hover: hover) {
:host(.button-solid.ion-color:hover) .button-native::after {
background: globals.current-color(shade);
}
}

// Button: Disabled
// --------------------------------------------------

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading