FocusCaptureMixin

Allows Tab and Shift+Tab operations to cycle the focus within the component

Overview

This mixin expects the component to provide:

  • A template-stamping mechanism compatible with ShadowTemplateMixin.

The mixin provides these features to the component:

  • Template elements and event handlers that will cause the keyboard focus to wrap.

This mixin contributes to a component's template. See that discussion for details on how to use such a mixin.

API

Used by classes AlertDialog, Dialog, Drawer, DrawerWithGrip, PlainAlertDialog, PlainDialog, PlainDrawer, and PlainDrawerWithGrip.

wrap(target) method

Destructively wrap a node with elements necessary to capture focus.

Call this method in a components internal.template property. Invoke this method as this[FocusCaptureMixin.wrap](element).

Parameters:

  • target: Elementthe element within which focus should wrap