Skip to content

Commit

Permalink
fix: no focus-outline when using mouse navigation
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #4393
  • Loading branch information
ivarni committed Dec 30, 2024
1 parent e1df3cc commit aa3cd53
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 16 deletions.
8 changes: 5 additions & 3 deletions packages/combobox/combobox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,11 @@ $_combobox-search-input-selection-color--inverted: color.scale(
padding: var(--jkl-combobox-button-active-value-padding);
}

&:has(:focus-visible) {
@include jkl.focus-outline;
background-color: var(--jkl-combobox-open-background-color);
@include jkl.keyboard-navigation {
&:has(:focus-visible) {
@include jkl.focus-outline;
background-color: var(--jkl-combobox-open-background-color);
}
}

&:has(.jkl-icon-button:focus-visible) {
Expand Down
8 changes: 5 additions & 3 deletions packages/jokul/src/components/combobox/styles/combobox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ $_combobox-search-input-selection-color--inverted: color.scale(
padding: var(--jkl-combobox-button-active-value-padding);
}

&:has(:focus-visible) {
@include jkl.focus-outline;
background-color: var(--jkl-combobox-open-background-color);
@include jkl.keyboard-navigation {
&:has(:focus-visible) {
@include jkl.focus-outline;
background-color: var(--jkl-combobox-open-background-color);
}
}

&:has(.jkl-icon-button:focus-visible) {
Expand Down
27 changes: 22 additions & 5 deletions packages/jokul/src/components/select/styles/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

@include jkl.reset-outline;

& *:focus {
& *:focus-visible {
outline: none;
}

Expand Down Expand Up @@ -113,10 +113,6 @@
color: var(--jkl-color-text-default);
}

&:focus {
@include jkl.focus-outline;
}

&:hover {
border-color: var(--jkl-color-border-input-focus);
box-shadow: 0 0 0 jkl.rem(1px) var(--jkl-color-border-input-focus);
Expand All @@ -125,6 +121,27 @@
transform: translateY(calc(-50% + #{jkl.rem(3px)}));
}
}

&:focus-visible {
outline: none;
}
}

@include jkl.keyboard-navigation {
&__search-input,
&__button {
&:focus-visible,
&:has(:focus-visible) {
@include jkl.focus-outline;
}
}

&:has(:focus-visible) {
.jkl-select__button,
.jkl-select__search-input {
@include jkl.focus-outline;
}
}
}

&__button {
Expand Down
27 changes: 22 additions & 5 deletions packages/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

@include jkl.reset-outline;

& *:focus {
& *:focus-visible {
outline: none;
}

Expand Down Expand Up @@ -113,10 +113,6 @@
color: var(--jkl-color-text-default);
}

&:focus {
@include jkl.focus-outline;
}

&:hover {
border-color: var(--jkl-color-border-input-focus);
box-shadow: 0 0 0 jkl.rem(1px) var(--jkl-color-border-input-focus);
Expand All @@ -125,6 +121,27 @@
transform: translateY(calc(-50% + #{jkl.rem(3px)}));
}
}

&:focus-visible {
outline: none;
}
}

@include jkl.keyboard-navigation {
&__search-input,
&__button {
&:focus-visible,
&:has(:focus-visible) {
@include jkl.focus-outline;
}
}

&:has(:focus-visible) {
.jkl-select__button,
.jkl-select__search-input {
@include jkl.focus-outline;
}
}
}

&__button {
Expand Down

0 comments on commit aa3cd53

Please sign in to comment.