Skip to content

Conversation

@GuySartorelli
Copy link
Member

This PR uses CSS variables to set focus outline style, colour, width, and offset.
This has a few advantages over relying directly on SCSS variables:

  • Developers can easily update the styles of their own components and even our components by simply updating CSS variable values
  • We don't need to redeclare any of the outline-* CSS properties, which means the specificity remains very broad, making targetted updates very easy.

This PR updates all focus-visible styling to be consistent. Broadly speaking:

  • Focused elements have a dark blue outline
  • If the background is too dark for the outline to display, a white outline is used instead.
  • If there is no room to display an outline outside the focused element, the outline is inset inside the element's boundaries

Issue

display: inline;

&:focus {
&:focus-visible {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

focus-visible lets the browser decide when the focus outline is displayed. This means our styles are more inline with browser defaults 👍

//$btn-box-shadow: inset 0 1px 0 rgba($white,.15), 0 1px 1px rgba($black,.075) !default;
//$btn-focus-box-shadow: 0 0 0 3px rgba($primary, .25) !default;
$btn-box-shadow: none;
$btn-focus-box-shadow: none;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing a bunch of drop shadows in favour of the new focus outline

* ----------------------------------------------------------------- */
.breadcrumbs-wrapper {
width: 250px; // to enable flexbox auto-grow
overflow: hidden;
Copy link
Member Author

@GuySartorelli GuySartorelli Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was originally added in #304.
I tried adding a bunch of pages, some with long names, and didn't experience any difference with this vs without it - except that without it the focus outline displays correctly for links at the edges of the wrapper boundaries.

Here's a screenshot of my test, note it looked like this both with and without hiding the overflow.

Screenshot from 2026-01-06 16-32-06

@GuySartorelli GuySartorelli force-pushed the pulls/3/focus-outline branch from a5db5dd to 1afeb0d Compare January 7, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant