Skip to content

Code snippets are not scrollable by keyboard users #162

Open

Description

@sbeaumontweb

Screenshot 2021-06-30 at 17 39 43

Proposing fix by adding a tabindex to the code blocks to allow sideways scrolling to make content readable for keyboard users when it overflows.

Activity

  1. mathalete commented on Aug 9, 2023

    @mathalete

    Good spot.

    Maybe better to have a listener to determine if there is overflow on the code container, and add the tabindex dynamically when it's needed.

    Something like if scrollWidth > clientWidth on the container, then add tabindex="0" if not, don't.

    If we're adding a tabindex (statically or dynamically), it'd be recommended to also add an aria role and accessible name so if you can't see the screen, and you are tabbing through it, it's clear why this guy is receiving focus.

    <div role="group" tabindex="0" aria-labelledby="[code block name in page]">....</div>

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions