Skip to main content
cngx-src documentation

CNGX_FOCUSABLE_SELECTOR

Variablecommon/a11y

projects/common/a11y/focus/focus-restore.directive.ts

Description#

CSS selector matching natively-focusable elements: links with an href, the enabled form controls, and anything with an explicit non-negative tabindex. Form controls carry :not(:disabled) because a disabled control is not in the tab order - without it a descendant probe would count a disabled button as focusable and a restore target could land on an unfocusable element. Single source of truth for "is this focusable" - the element-level CngxFocusRestore predicate matches against it, and descendant probes (e.g. "does this panel contain a focusable child?") query against it. Keeping one selector stops the two uses from drifting apart.

Type#

string

Default value#

'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])'