From 00177898f55573a682a43819b08304c1f60a732a Mon Sep 17 00:00:00 2001 From: Ken <26967723+KenAJoh@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:20:10 +0100 Subject: [PATCH] [Select] :bug: Focus-border no longer cancels out error-border. (#3465) * :bug: Focus-border no longer cancels out error-border. * :recycle: Optimize CSS selectors, fix textarea * :memo: Changeset --- .changeset/late-turkeys-drive.md | 5 +++++ .changeset/young-goats-smash.md | 5 +++++ @navikt/core/css/form/select.css | 6 +++++- @navikt/core/css/form/textarea.css | 9 +++------ 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 .changeset/late-turkeys-drive.md create mode 100644 .changeset/young-goats-smash.md diff --git a/.changeset/late-turkeys-drive.md b/.changeset/late-turkeys-drive.md new file mode 100644 index 0000000000..566ba5b2d1 --- /dev/null +++ b/.changeset/late-turkeys-drive.md @@ -0,0 +1,5 @@ +--- +"@navikt/ds-css": patch +--- + +Select: :bug: Focus-border no longer cancels out error-border. diff --git a/.changeset/young-goats-smash.md b/.changeset/young-goats-smash.md new file mode 100644 index 0000000000..14452cb9fd --- /dev/null +++ b/.changeset/young-goats-smash.md @@ -0,0 +1,5 @@ +--- +"@navikt/ds-css": patch +--- + +Textarea: :bug: Focus-border no longer cancels out error-border. diff --git a/@navikt/core/css/form/select.css b/@navikt/core/css/form/select.css index e5ad882f43..1f37f78eb6 100644 --- a/@navikt/core/css/form/select.css +++ b/@navikt/core/css/form/select.css @@ -73,11 +73,15 @@ /** Error handling */ -.navds-select--error > * select:not(:hover, :focus, :disabled) { +.navds-select--error > * .navds-select__input:not(:hover, :disabled) { box-shadow: 0 0 0 1px var(--ac-select-error-border, var(--a-surface-danger)); border-color: var(--ac-select-error-border, var(--a-surface-danger)); } +.navds-select--error .navds-select__input:focus { + box-shadow: var(--a-shadow-focus); +} + /** Disabled */ diff --git a/@navikt/core/css/form/textarea.css b/@navikt/core/css/form/textarea.css index 9918e0a845..83b49fff9f 100644 --- a/@navikt/core/css/form/textarea.css +++ b/@navikt/core/css/form/textarea.css @@ -111,16 +111,13 @@ /** Error handling */ -.navds-textarea--error .navds-textarea__input:not(:hover, :focus-visible, :disabled) { +.navds-textarea--error .navds-textarea__input:not(:hover, :disabled) { box-shadow: 0 0 0 1px var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger))); border-color: var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger))); } -@supports not selector(:focus-visible) { - .navds-textarea--error .navds-textarea__input:not(:hover, :focus, :disabled) { - box-shadow: 0 0 0 1px var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger))); - border-color: var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger))); - } +.navds-textarea--error .navds-textarea__input:focus-visible { + box-shadow: var(--a-shadow-focus); } .navds-textarea__input:disabled {