Use keyboard to expand the tree

Created on 26 March 2024, about 1 year ago

Problem/Motivation

We use a Term Reference Tree widget to display a field on our user registration/user edit forms. Accessibility is an important factor for our site, and the fact that the term reference tree can't be expanded with the keyboard was flagged as an issue.

I used an existing issue, Cannot expand tree using just a keyboard πŸ› Cannot expand tree using just a keyboard Active , as the basis for my solution but applied it to the 2.0.x version of the module.

Steps to reproduce

Set a field on a form display to Term reference tree. Use the following settings:

  • Start minimized: True
  • Leaves only: True
  • Select parents automatically: False
  • Cascading selection: None
  • Maximum depth: 0

Proposed resolution

I'll attach a patch that'll do the following:

  • Add a tabindex attribute to the checkbox-tree-item template so users can navigate to it with the keyboard.
  • Bind the spacebar and Enter keys to the checkbox-tree-item div element to mimic the way you can check/uncheck checkboxes and radio buttons.

Remaining tasks

TBD

User interface changes

Add the ability to use the keyboard to navigate the term reference tree widget.

✨ Feature request
Status

Active

Version

2.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States jsutta United States

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024