Skip to content

(a11y) Keyboard focus indicator #48121

Closed

Description

@bbsmooth

Describe the Issue

We are relying on the browser's default keyboard focus indicator for quite a few focusable elements and it just isn't very accessible in certain browsers (looking at you Chrome). We really need to settle on a focus indicator color and then make sure every focusable element uses it for the focus outline. I've been using our CSS custom variable --blue-mid for things I've worked on because it has accessible contrast with both our light and dark themes (you can see this in the main nav menu or the tabs when viewing a step in narrow view).

Affected Page

https://www.freecodecamp.org/learn/2022/responsive-web-design/learn-typography-by-building-a-nutrition-label/step-66

Steps to Reproduce

Using Chrome (or any chrome-based browser), open the page in wide (desktop) view and start tabbing through the controls. When you get to the five buttons above the editor the focus outline will barely be noticeable on some of them and pretty much non-existent on others. Also notice that we have several different focus outline colors in the header/breadcrumbs. While not technically a WCAG violation I think having a standard color for all of them would be better (not just aesthetically but also for accessibility).

Expected behavior

Perhaps create a custom CSS variable for the focus outline color and then start updating all of our focusable elements to use it. The width of the outline could vary depending on how much space we have and where the element is located, but I would recommend at least a width of 2px.

Even if we won't be able to settle on an official outline color for a while, I still think we should pick a temporary one for now and put it in place so that when we do finally settle on a color it will be relatively easy to make the switch. Also, CSS allows us to only show the focus outline to people using the keyboard to navigate the page, so I'm guessing most of our users won't even see it. Thus, picking a temporary color for now isn't going to affect the aesthetics for most users but will make an immediate impact on accessibility for those who rely on it. I guess I'm asking that we make the accessibility improvements now instead of waiting until we have an official color scheme in place.

Screenshots

No response

System

  • Device: Desktop
  • OS: Both Linux Fedora 36 and Windows 11
  • Browser: Chrome
  • Version: 106

Additional context

No response

Activity

  1. added
    status: discussing
    scope: a11y
    on Oct 18, 2022
  2. ahmaxed commented on Oct 19, 2022

    @ahmaxed
    Member

    That makes sense and you cannot go wrong with mid-blue. We can move forward with adding the outlines here and reapply them to the upcoming component library (some already have them).

  3. added
    help wanted
    and removed
    status: discussing
    on Jan 4, 2023
  4. bbsmooth commented on Mar 6, 2023

    @bbsmooth
    ContributorAuthor

    A design question. When we have a button with a border, such as:

    fcc-button1

    Should the keyboard focus outline go around the outside of the border so that the border is still visible:

    fcc-button2

    Or should the keyboard focus outline cover the border:

    fcc-button3

    Or perhaps sometimes we want one and sometimes the other?

    P.S. Just want to add that either way is accessible, so it's more a question of aesthetics.

  5. ahmaxed commented on Mar 15, 2023

    @ahmaxed
    Member

    I'm gravitating towards covering the border since it would take less space.
    So both would work. Regardless of what we do, it should be implemented across.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedscope: a11y

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions