Class: FocusManager

wp.media.view. FocusManager


new FocusManager()

wp.media.view.FocusManager
Source:

Extends

Members


ariaHiddenElements

Stores an array of DOM elements that should be hidden from assistive technologies, for example when the media modal dialog opens.
Since:
  • 5.2.3
Source:

isBodyAriaHidden

Whether the body children are hidden from assistive technologies.
Since:
  • 5.2.3
Source:

tabs

Holds the jQuery collection of ARIA tabs.
Since:
  • 5.3.0
Source:

Methods


activateTab(tab)

Sets a single tab to be focusable and semantically selected.
Parameters:
Name Type Description
tab object The tab DOM element.
Since:
  • 5.3.0
Source:
Returns:
Type
void

constrainTabbing(event)

Constrains navigation with the Tab key within the media view element.
Parameters:
Name Type Description
event Object A keydown jQuery event.
Since:
  • 4.0.0
Source:
Returns:
Type
void

dispose()

Inherited From:
Source:
To Do:
  • The internal comment mentions this might have been a stop-gap before Backbone 0.9.8 came out. Figure out if Backbone core takes care of this in Backbone.View now.
Returns:
Returns itself to allow chaining.
Type
wp.media.View

elementShouldBeHidden(element)

Determines if the passed element should not be hidden from assistive technologies.
Parameters:
Name Type Description
element object The DOM element that should be checked.
Since:
  • 5.2.3
Source:
Returns:
Whether the element should not be hidden from assistive technologies.
Type
boolean

focus()

Moves focus to the modal dialog.
Since:
  • 3.5.0
Source:
Returns:
Type
void

focusManagementMode(event)

Determines which focus management mode to use.
Parameters:
Name Type Description
event object jQuery event object.
Since:
  • 5.3.0
Source:
Returns:
Type
void

getTabbables()

Gets all the tabbable elements.
Since:
  • 5.3.0
Source:
Returns:
A jQuery collection of tabbable elements.
Type
object

initialize(options)

Initializes the Focus Manager.
Parameters:
Name Type Description
options object The Focus Manager options.
Since:
  • 5.3.0
Source:
Returns:
Type
void

remove()

Inherited From:
Source:
Returns:
Returns itself to allow chaining.
Type
wp.media.View

removeAriaHiddenFromBodyChildren()

Unhides from assistive technologies all the body children. Makes visible again to assistive technologies all the body children previously hidden and stored in this.ariaHiddenElements.
Since:
  • 5.2.3
Source:
Returns:
Type
void

setAriaHiddenOnBodyChildren(visibleElement)

Hides from assistive technologies all the body children. Sets an `aria-hidden="true"` attribute on all the body children except the provided element and other elements that should not be hidden. The reason why we use `aria-hidden` is that `aria-modal="true"` is buggy in Safari 11.1 and support is spotty in other browsers. Also, `aria-modal="true"` prevents the `wp.a11y.speak()` ARIA live regions to work as they're outside of the modal dialog and get hidden from assistive technologies.
Parameters:
Name Type Description
visibleElement object The jQuery object representing the element that should not be hidden.
Since:
  • 5.2.3
Source:
Returns:
Type
void

setupAriaTabs(event)

Sets up tabs in an ARIA tabbed interface.
Parameters:
Name Type Description
event object jQuery event object.
Since:
  • 5.3.0
Source:
Returns:
Type
void

switchTabs(event)

Switches tabs in the ARIA tabbed interface.
Parameters:
Name Type Description
event object jQuery event object.
Since:
  • 5.3.0
Source:
Returns:
Type
void

tabsNavigation(event)

Enables arrows navigation within the ARIA tabbed interface.
Parameters:
Name Type Description
event object jQuery event object.
Since:
  • 5.3.0
Source:
Returns:
Type
void