Skip to content

Commit

Permalink
Bugfix/missing red border on combobox with error (#2184)
Browse files Browse the repository at this point in the history
Co-authored-by: Ken <ken.aleksander@gmail.com>
  • Loading branch information
it-vegard and KenAJoh authored Aug 17, 2023
1 parent 6cb25e4 commit 5cda39c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/fifty-spoons-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@navikt/ds-react": patch
"@navikt/ds-css": patch
---

Added red border to Combobox in error state
10 changes: 10 additions & 0 deletions @navikt/core/css/form/combobox.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
cursor: text;
}

.navds-combobox--error .navds-text-field__input:not(:hover):not(:disabled) {
border-color: var(--ac-combobox-error-border, var(--a-border-danger));
box-shadow: 0 0 0 1px var(--ac-combobox-error-border, var(--a-border-danger));
}

.navds-combobox--error
.navds-text-field__input:not(:hover):not(:disabled):not(.navds-combobox__wrapper-inner--virtually-unfocused):focus-within {
box-shadow: 0 0 0 1px var(--ac-combobox-error-border, var(--a-border-danger)), var(--a-shadow-focus);
}

.navds-combobox__selected-options {
gap: var(--a-spacing-2);
align-items: center;
Expand Down
3 changes: 2 additions & 1 deletion @navikt/core/css/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@
"--ac-combobox-list-item-selected-hover-bg": "--a-surface-action-subtle-hover",
"--ac-combobox-list-item-loading-bg": "--a-surface-default",
"--ac-combobox-list-item-hover-border-left": "--a-border-strong",
"--ac-combobox-list-item-selected-hover-border-left": "--a-border-focus"
"--ac-combobox-list-item-selected-hover-border-left": "--a-border-focus",
"--ac-combobox-error-border": "--a-border-danger"
},
"select": {
"--ac-select-bg": "--a-surface-default",
Expand Down
5 changes: 2 additions & 3 deletions @navikt/core/react/src/form/combobox/ComboboxWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ const ComboboxWrapper = ({
className,
"navds-form-field",
`navds-form-field--${inputSize}`,
"navds-search",
{
"navds-search--error": hasError,
"navds-search--disabled": !!inputProps.disabled,
"navds-combobox--error": hasError,
"navds-combobox--disabled": !!inputProps.disabled,
"navds-combobox--focused": hasFocusWithin,
}
)}
Expand Down

0 comments on commit 5cda39c

Please sign in to comment.