Repository navigation
feat(button): show only the icon and vertical badges in icon-only buttons #31648
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
Changes from all commits
d2a0364
db6eca1
3c8aba6
ba5108a
6c03447
554b0cb
638bfbc
736ff49
22d07b4
8878102
ba8c040
41f7635
de1c6ae
339daa0
0700826
483ae2f
a8cf631
e371569
791e695
9f6aee1
5feb0ce
ec7aeb9
dd49a78
73bcbf1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,6 +179,23 @@ $spinner-sizes: xsmall, small, medium, large, xlarge; | |
| } | ||
| } | ||
|
|
||
| // An icon-only button shows only its icon and badges with a `vertical` position | ||
| :host(.button-has-icon-only) ::slotted([slot="start"]), | ||
| :host(.button-has-icon-only) ::slotted([slot="end"]), | ||
| :host(.button-has-icon-only) ::slotted(:not([slot]):not(ion-badge[vertical])) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one worries me a bit, because text wrapped in an element loses its accessible name now. With |
||
| display: none; | ||
| } | ||
|
|
||
| /** | ||
| * Text can't be selected, so the default slot passes it a zero font size. | ||
| * Letter spacing is inherited in px, so it's reset too. | ||
| */ | ||
| :host(.button-has-icon-only) slot:not([name]) { | ||
| font-size: 0; | ||
|
|
||
| letter-spacing: 0; | ||
| } | ||
|
|
||
| // Button: Slotted Elements | ||
| // -------------------------------------------------- | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outside CSS that sets
displaybeats these::slotted()rules, so the start and end content can come back. In the ionic theme the global link style does it, so<a slot="start" href="#x">Link</a>in an icon-only button still renders, gets its own tab stop, and becomes the button's name. Could we skip rendering the start and end slots whenhasIconOnly, or make these!important? An<a slot="start">case in the tests would cover it.