Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a focus outline to interactive elements #6948

Open
wants to merge 6 commits into
base: 2.5
Choose a base branch
from

Conversation

FlorianBoe
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations?
Fixed tickets
Related issues/PRs #6444
License MIT
Documentation PR

What's in this PR?

I added a focus outline to interactive elements. The focus outline is still reset globally, but then re-enabled with focus-visible for keyboard use. Focusable elements get a focus outline only if they are focused while tabbing.

Text inputs and textareas are an exception to this logic, since they always match the pseudo-class :focus pseudo-class because they expect keyboard inputs.

I can remove the focus outline for text inputs, but it would be useful to think about whether the input fields should also have a custom focus state. For example, by making the border of the element darker.

A modern progressive enhancement would be a solution with :has:

.input:has(input:focus, textarea:focus) {
    border-color: $black;
}

I tried not to make any major design decisions, the outline is based on the default outline of the UA stylesheet. Custom focus states would of course improve the experience.

Why?

An important element for keyboard usability is the focus outline. Generally, overriding the browser's default outline is a bad idea.

Visual representation in Chromium browsers

Bildschirm­foto 2022-12-15 um 11 44 07

Bildschirm­foto 2022-12-15 um 11 43 46

Bildschirm­foto 2022-12-15 um 11 43 38

Bildschirm­foto 2022-12-15 um 11 43 32

Bildschirm­foto 2022-12-15 um 12 38 32

I am aware that this change has an influence on the design of the admin interface and probably has to be discussed internally. If design adjustments are necessary, I can implement them with pleasure.

@alexander-schranz alexander-schranz added Design required For this issue a design form our UX expert is required UX Affecting the end user labels Dec 15, 2022
@alexander-schranz
Copy link
Member

@FlorianBoe Thank you for the input here. We need to check this with the UI/UX team what focus state they want to provide for the elements. If you stumble over other elements, feel free to add them here to the pull request description.

@alexander-schranz alexander-schranz added Design in progress The feature requires a design and the design is currenlty in progress. and removed Design required For this issue a design form our UX expert is required labels Apr 18, 2024
@alexander-schranz
Copy link
Member

@FlorianBoe Sorry for the late response here. Want to give an update that we did have today a meeting with the UI/UX Team and put this ticket as one of the prioritzed ticket to it and so we hopefully will get feedback here soonish how this Focus Visible states should be displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design in progress The feature requires a design and the design is currenlty in progress. UX Affecting the end user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants