Change record status: 
Project: 
Introduced in branch: 
9.3.x
Introduced in version: 
9.3.0-alpha1
Description: 

Prior to this change, Drupal.tabbingManager could constrain tabbing to a specific set of elements, but it could not trap focus within that set of elements. I.e. prior to this change, tabbing out of the final element in the set or shift-tabbing out of the first element in the set would result in focus leaving the browser viewport entirely.

Drupal.tabbingManager now has the ability to trap focus, so tabbing the final element in a set moves focus to the first element in the set, and shift-tabbing the first element in the set moves focus to the last element in the set. With trap focus enabled, it's not possible to tab out of the browser viewport. This is helpful in use cases such as dialogs where tabbing should remain in that dialog until it closes.

The default behavior of Drupal.tabbingManager remains the same. Trap focus must be explicitly configured when invoking Drupal.tabbingManager. Drupal.tabbingManager.constrain now accepts a second argument: an object which can include the trapFocus property. When true focus will be trapped within the set of constrained elements.
To trap focus, use the second argument as shown here:
Drupal.tabbingManager.constrain(element, { trapFocus: true });

Note that using this functionality must be done carefully to not create keyboard traps. See WCAG SC 2.1.2 for reference.

Impacts: 
Module developers
Themers