Skip to content

Commit

Permalink
fix(breadcrumb, link): fix focus ring
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMenga committed Apr 18, 2024
1 parent 7a1c5a5 commit b8a2889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/components/breadcrumb/breadcrumb/breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
color: var(--sbb-breadcrumb-color);
align-items: center;
overflow: hidden;
outline: none;

@include sbb.if-forced-colors {
--sbb-breadcrumb-color: ButtonText;
}

// Hide focus outline when focus origin is mouse or touch. This is being used as a workaround in various components.
&:focus-visible:not([data-focus-origin='mouse'], [data-focus-origin='touch']) {
:host(:not([data-focus-origin='mouse'], [data-focus-origin='touch'])) &:focus-visible {
@include sbb.focus-outline;

border-radius: var(--sbb-border-radius-2x);
Expand Down
9 changes: 2 additions & 7 deletions src/components/link/common/link.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// Box-sizing rules contained in typography are not traversing Shadow DOM boundaries. We need to include box-sizing mixin in every component.
@include sbb.box-sizing;

:host {
// Use !important here to not interfere with Firefox focus ring definition
// which appears in normalize css of several frameworks.
outline: none !important;
}

:host([role='button']) {
@include sbb.link-variables--button;
}
Expand All @@ -22,6 +16,7 @@
width: 100%;
cursor: pointer;
padding: var(--sbb-link-padding, 0);
outline: none;

:host([disabled]) & {
pointer-events: none;
Expand All @@ -33,7 +28,7 @@
}

// Hide focus outline when focus origin is mouse or touch. This is being used as a workaround in various components.
&:focus-visible:not([data-focus-origin='mouse'], [data-focus-origin='touch']) {
:host(:not([data-focus-origin='mouse'], [data-focus-origin='touch'])) &:focus-visible {
@include sbb.focus-outline;

border-radius: calc(var(--sbb-border-radius-4x) - var(--sbb-focus-outline-offset));
Expand Down

0 comments on commit b8a2889

Please sign in to comment.