Skip to content

Commit

Permalink
Focus > fix markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
nicozerr committed Oct 9, 2023
1 parent 1a68471 commit a674c81
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions _doc/accessibility/presentation-of-information/visible-focus.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ Disabling the outline property for :hover and :active states is not considered n

## Focus contrast

THe contrast of this outline must be at least 3:1 with the interactive element and the background.
The contrast of this outline must be at least 3:1 with the interactive element and the background.

## Browsers' default outline

Here is the default outline to be defined, to ensure it's conform and visible.
Here is the default outline to be defined on project where outline is hidden or not visible enough.

`outline: 2px auto Highlight; /* for all browsers */`
`outline: auto 2px -webkit-focus-ring-color; /* for webkit-based browsers */`
`outline-offset: 1px; /* to be adapted according to the element visibility */`
```css
*:focus {
outline: 2px auto Highlight; /* for all browsers */
outline: auto 2px -webkit-focus-ring-color; /* for webkit-based browsers */
outline-offset: 1px; /* to be adapted according to the element visibility */
}
```

The property `Highlight` can be replaced by `currentColor` (like in the Starter) if the contrast is sufficient.

Expand All @@ -60,8 +64,10 @@ The property `Highlight` can be replaced by `currentColor` (like in the Starter)
Floating element (fixed main menu, cookie banner...) must not hide the focus, in any resolution or zoom percentage.
To prevent it, use the `scroll-padding` property on `body` and `html` tags.

`html,body {`
` scroll-padding: 33% 0px;`
`}`
```css
html,body {
scroll-padding: 33% 0px;
}
```

In the previous example, the scroolbar will automatically move if the focus is at least at 33% from the top and the bottom of the page.

0 comments on commit a674c81

Please sign in to comment.