[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/vendor/focus-visible/js/ -> focus-visible.js (summary)

(no description)

File Size: 312 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 13 functions

  applyFocusVisiblePolyfill()
  isValidFocusTarget()
  focusTriggersKeyboardModality()
  addFocusVisibleClass()
  removeFocusVisibleClass()
  onKeyDown()
  onPointerDown()
  onFocus()
  onBlur()
  onVisibilityChange()
  addInitialPointerMoveListeners()
  removeInitialPointerMoveListeners()
  onInitialPointerMove()

Functions
Functions that are not part of a class:

applyFocusVisiblePolyfill(scope)   X-Ref
Applies the :focus-visible polyfill at the given scope.
A scope in this case is either the top-level Document or a Shadow Root.

param: {(Document|ShadowRoot)} scope

isValidFocusTarget(el)   X-Ref
Helper function for legacy browsers and iframes which sometimes focus
elements like document, body, and non-interactive SVG.

param: {Element} el

focusTriggersKeyboardModality(el)   X-Ref
Computes whether the given element should automatically trigger the
`focus-visible` class being added, i.e. whether it should always match
`:focus-visible` when focused.

param: {Element} el
return: {boolean}

addFocusVisibleClass(el)   X-Ref
Add the `focus-visible` class to the given element if it was not added by
the author.

param: {Element} el

removeFocusVisibleClass(el)   X-Ref
Remove the `focus-visible` class from the given element if it was not
originally added by the author.

param: {Element} el

onKeyDown(e)   X-Ref
If the most recent user interaction was via the keyboard;
and the key press did not include a meta, alt/option, or control key;
then the modality is keyboard. Otherwise, the modality is not keyboard.
Apply `focus-visible` to any current active element and keep track
of our keyboard modality state with `hadKeyboardEvent`.

param: {KeyboardEvent} e

onPointerDown(e)   X-Ref
If at any point a user clicks with a pointing device, ensure that we change
the modality away from keyboard.
This avoids the situation where a user presses a key on an already focused
element, and then clicks on a different element, focusing it with a
pointing device, while we still think we're in keyboard modality.

param: {Event} e

onFocus(e)   X-Ref
On `focus`, add the `focus-visible` class to the target if:
- the target received focus as a result of keyboard navigation, or
- the event target is an element that will likely require interaction
via the keyboard (e.g. a text box)

param: {Event} e

onBlur(e)   X-Ref
On `blur`, remove the `focus-visible` class from the target.

param: {Event} e

onVisibilityChange(e)   X-Ref
If the user changes tabs, keep track of whether or not the previously
focused element had .focus-visible.

param: {Event} e

addInitialPointerMoveListeners()   X-Ref
Add a group of listeners to detect usage of any pointing devices.
These listeners will be added when the polyfill first loads, and anytime
the window is blurred, so that they are active when the window regains
focus.


removeInitialPointerMoveListeners()   X-Ref
No description

onInitialPointerMove(e)   X-Ref
When the polfyill first loads, assume the user is in keyboard modality.
If any event is received from a pointing device (e.g. mouse, pointer,
touch), turn off keyboard modality.
This accounts for situations where focus enters the page from the URL bar.

param: {Event} e



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer