Skip to content

Commit

Permalink
🐛 Select get focus-outline when clicked in firefox, as focus-visible …
Browse files Browse the repository at this point in the history
…were ignored previously (#3415)
  • Loading branch information
KenAJoh authored Nov 29, 2024
1 parent 39db249 commit dce149f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-planes-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-css": patch
---

Select: Now shows focus-outline when ':focus' is set trough pointer or label in all browsers. Chrome and Firefox handles `:focus-visible` differently for 'select', previously causing outline-border not to show in Firefox.
6 changes: 3 additions & 3 deletions @navikt/core/css/darkside/form/select.darkside.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
cursor: pointer;
}

&:focus-visible {
&:focus {
outline: 2px solid var(--ax-border-focus);
outline-offset: 2px;
border-color: var(--ax-border-accent-strong);
Expand Down Expand Up @@ -71,7 +71,7 @@
}

> * select:hover,
> * select:focus-visible {
> * select:focus {
box-shadow: 0 0 0 1px var(--ax-border-danger-strong);
border-color: var(--ax-border-danger-strong);
}
Expand Down Expand Up @@ -107,7 +107,7 @@
cursor: default;

@media (forced-colors: active) {
&:is(:hover, :focus-visible) {
&:is(:hover, :focus) {
background-color: ButtonFace;
border-color: ButtonText;
color: ButtonText;
Expand Down
11 changes: 2 additions & 9 deletions @navikt/core/css/form/select.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
box-shadow: none;
}

.navds-select__input.navds-select__input.navds-select__input:focus-visible {
.navds-select__input.navds-select__input.navds-select__input:focus {
outline: 2px solid highlight;
outline-offset: 2px;
}
Expand All @@ -33,19 +33,12 @@
cursor: pointer;
}

.navds-select__input:focus-visible {
.navds-select__input:focus {
outline: none;
border-color: var(--ac-select-active-border, var(--a-border-action-selected));
box-shadow: var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
.navds-select__input:focus {
outline: none;
box-shadow: var(--a-shadow-focus);
}
}

.navds-select__container {
position: relative;
display: flex;
Expand Down

0 comments on commit dce149f

Please sign in to comment.