refactor(button): update focus ring to avoid additional API (#29223)

This commit is contained in:
Liam DeBeasi
2024-03-26 13:40:11 -04:00
committed by GitHub
parent 4cf1b9737d
commit 7eae6ec591
15 changed files with 3 additions and 23 deletions

View File

@ -265,7 +265,6 @@ ion-button,css-prop,--padding-start
ion-button,css-prop,--padding-top
ion-button,css-prop,--ripple-color
ion-button,css-prop,--transition
ion-button,part,focus-ring
ion-button,part,native
ion-buttons,scoped

View File

@ -156,26 +156,9 @@
// -------------------------------------------------------------------------------
// Only show the focus ring when the button is focused
:host(.ion-focused) {
--overflow: visible;
.button-native::after {
@include border-radius(inherit);
}
}
.button-focus-ring {
@include position(-4px, -4px, -4px, -4px);
@include border-radius(inherit);
position: absolute;
transition: border-color 0.3s;
border: var(--focus-ring-width) solid var(--focus-ring-color);
content: "";
box-sizing: border-box;
:host(.ion-focused) .button-native {
outline: var(--focus-ring-width) solid var(--focus-ring-color);
outline-offset: 2px;
}
// Fill Solid Button

View File

@ -20,7 +20,6 @@ import type { RouterDirection } from '../router/utils/interface';
* @slot end - Content is placed to the right of the button text in LTR, and to the left in RTL.
*
* @part native - The native HTML button or anchor element that wraps all child elements.
* @part focus-ring - The visual indicator that appears as an outline around the button when focused. Only available for the Ionic theme.
*/
@Component({
tag: 'ion-button',
@ -418,7 +417,6 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
<slot name="end"></slot>
</span>
{theme === 'md' && <ion-ripple-effect type={this.rippleType}></ion-ripple-effect>}
{theme === 'ionic' && <div part="focus-ring" class="button-focus-ring"></div>}
</TagType>
</Host>
);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB