Show:

Widget extension, which can be used to add modality support to the base Widget class, through the Base.create method.

Methods

_afterFocusOnChange

()

Default function called when focusOn Attribute is changed. Remove existing listeners and create new listeners.

_afterHostVisibleChangeModal

(
  • e
)

Default function that is called when visibility is changed on the widget.

Parameters:

  • e EventFacade

    <p><p>The event facade of the change</p></p>

_afterHostZIndexChangeModal

(
  • e
)

Default function that is called when z-index is changed on the widget.

Parameters:

  • e EventFacade

    <p><p>The event facade of the change</p></p>

_attachUIHandlesModal

()

Attaches UI Listeners for "clickoutside" and "focusoutside" on the widget. When these events occur, and the widget is modal, focus is shifted back onto the widget.

_bindUIModal

() protected

Hooks up methods to be executed when the widget's visibility or z-index changes <p> This method in invoked after bindUI is invoked for the Widget class using YUI's aop infrastructure. </p>

_blockIFrameFocus

() protected

Blocks iframes on the page from getting focused by setting their tabIndex attribute to -1. The previous value of tabIndex is saved so it can be restored later.

_blur

()

Blurs the widget.

_detachUIHandlesModal

()

Detaches all UI Listeners that were set in _attachUIHandlesModal from the widget.

_focus

()

Provides mouse and tab focus to the widget's bounding box.

_GET_MASK

() static

Returns the mask if it exists on the page - otherwise creates a mask. There's only one mask on a page at a given time. <p> This method in invoked internally by the getter of the maskNode ATTR. </p>

_getMaskNode

() Node

Returns the Y.Node instance of the maskNode

Returns:

Node:

<p><p>The Y.Node instance of the mask, as returned from WidgetModal._GET_MASK</p></p>

_renderUIModal

() protected

Adds modal class to the bounding box of the widget <p> This method in invoked after renderUI is invoked for the Widget class using YUI's aop infrastructure. </p>

_repositionMask

(
  • nextElem
)

Repositions the mask in the DOM for nested modality cases.

Parameters:

  • nextElem Widget

    <p><p>The Y.Widget instance that will be visible in the stack once the current widget is closed.</p></p>

_resyncMask

(
  • nextElem
)
private

Resyncs the mask in the viewport for browsers that don't support fixed positioning

Parameters:

  • nextElem Y.Widget

    <p><p>The Y.Widget instance that will be visible in the stack once the current widget is closed.</p></p>

_syncUIModal

() protected

Syncs the mask with the widget's current state, namely the visibility and z-index of the widget <p> This method in invoked after syncUI is invoked for the Widget class using YUI's aop infrastructure. </p>

_uiSetHostVisibleModal

(
  • Whether
)

Performs events attaching/detaching, stack shifting and mask repositioning based on the visibility of the widget

Parameters:

  • Whether Boolean

    <p><p>the widget is visible or not</p></p>

_uiSetHostZIndexModal

(
  • Z-Index
)

Sets the z-index of the mask node.

Parameters:

  • Z-Index Number

    <p><p>of the widget</p></p>

_unblockIFrameFocus

() protected

Unblocks focus for the iframes on the page by restoring their original tabIndex attributes (see the _blockIFrameFocus method).

isNested

() public

Returns a boolean representing whether the current widget is in a "nested modality" state. This is done by checking the number of widgets currently on the stack.

Properties

ATTRS

Object static

Static property used to define the default attribute configuration introduced by WidgetModality.

STACK

Unknown

A stack of Y.Widget objects representing the current hierarchy of modal widgets presently displayed on the screen

Attributes

focusOn

Array

An array of objects corresponding to the nodes and events that will trigger a re-focus back on the widget. The implementer can supply an array of objects, with each object having the following properties: <p>eventName: (string, required): The eventName to listen to.</p> <p>node: (Y.Node, optional): The Y.Node that will fire the event (defaults to the boundingBox of the widget)</p> <p>By default, this attribute consists of two objects which will cause the widget to re-focus if anything outside the widget is clicked on or focussed upon.</p>

maskNode

Y.Node

Returns a Y.Node instance of the node being used as the mask.

modal

Boolean

Whether the widget should be modal or not.