diff --git a/packages/app-desktop/gui/NoteList/style.scss b/packages/app-desktop/gui/NoteList/style.scss index 50fc89a68..6b3e03502 100644 --- a/packages/app-desktop/gui/NoteList/style.scss +++ b/packages/app-desktop/gui/NoteList/style.scss @@ -36,6 +36,10 @@ width: 2px; height: 2px; } + + &:focus-visible { + outline: none; + } } .note-list-item-wrapper.-provisional { diff --git a/packages/app-desktop/main.scss b/packages/app-desktop/main.scss index 3c199ab58..15bc2d860 100644 --- a/packages/app-desktop/main.scss +++ b/packages/app-desktop/main.scss @@ -141,8 +141,23 @@ a { to {transform: rotate(360deg);} } -*:focus { - outline: none; + +*:focus-visible { + outline: 1px solid var(--joplin-color-warn); +} + +// The browser-default focus-visible indicator was originally removed for aesthetic +// reasons. However, this causes accessibility issues. +// +// As a comprimise, we disable the focus-visible indicator in cases where the user is +// probably not navigating with the keyboard. Note that :focus-visible alone is not +// sufficient because it matches any focused input (https://stackoverflow.com/a/66109577). +// +// See https://github.com/laurent22/joplin/issues/9982. +input:not([type=button]):not([type=checkbox]), select { + &:focus-visible { + outline: none; + } } /* ========================================================================================= diff --git a/packages/lib/services/noteList/defaultListRenderer.ts b/packages/lib/services/noteList/defaultListRenderer.ts index 49366e096..e77244a36 100644 --- a/packages/lib/services/noteList/defaultListRenderer.ts +++ b/packages/lib/services/noteList/defaultListRenderer.ts @@ -57,7 +57,7 @@ const renderer: ListRenderer = { background-color: var(--joplin-selected-color); } - &:hover { + &:hover, :focus-visible > & > .content { background-color: var(--joplin-background-color-hover3); }