export type DisplayObject = createjs.DisplayObject; export type AccessibleDisplayObject = DisplayObject & { accessible?: AccessibilityObject; }; type EventHandler = (evt: Event) => void; type KeyboardEventHandler = (evt: KeyboardEvent) => void; interface Props { accessKey?: string; dir?: string; id: string; key: number; lang?: string; onBlur: EventHandler; onFocus: EventHandler; onKeyDown?: KeyboardEventHandler; onKeyUp?: KeyboardEventHandler; spellCheck?: boolean; tabIndex?: number; title?: string; [key: string]: string | number | EventHandler | KeyboardEventHandler | boolean; } /** * Container for the accessibility information for a DisplayObject. */ export default class AccessibilityObject { private _areKeyEventsEnabled; private _children; private _controls; private _describedBy; protected readonly _displayObject: DisplayObject; private readonly _domId; private _flowTo; private _labelledBy; private _owns; private _parent; protected _reactProps: Props; private readonly _role; private _visible; private _markedForUpdate; private _htmlString; text: string; constructor(displayObject: DisplayObject, role: string, domIdPrefix: string); get isMarkedForUpdate(): boolean; markForUpdate(): void; markAsUpdated(): void; /** * Adds the specified DisplayObject as a child of the DisplayObject associated with this * AccessibilityObject in the accessibility tree. The specified DisplayObject must have * accessibility information already present. Different subclasses may limit the valid roles * for the specified DisplayObject. * @access public * @param {AccessibleDisplayObject} displayObject - accessibility annotated DisplayObject to * add as a child in the accessibility tree */ addChild(displayObject: AccessibleDisplayObject): void; /** * Adds the specified DisplayObject as a child of the DisplayObject associated with this * AccessibilityObject in the accessibility tree at the specified index. The specified * DisplayObject must have accessibility information already present. Different subclasses * may limit the valid roles for the specified DisplayObject (see addChild's function comment * for list of role restrictions). * @access public * @param {AccessibleDisplayObject} displayObject - accessibility annotated DisplayObject to add * as a child in the accessibility tree * @param {Number} index - 0 based index that the DisplayObject should have in the array of * children once added */ addChildAt(displayObject: AccessibleDisplayObject, index: number): void; /** * Removes all children of this AccessibilityObject from the accessibility tree. * @access public */ removeAllChildren(): void; /** * Removes the specified child of this AccessibilityObject from the accessibility tree. * @access public * @param {AccessibleDisplayObject} displayObject - child DisplayObject to remove */ removeChild(displayObject: AccessibleDisplayObject): void; /** * Removes the child at the specified index of this AccessibilityObject * from the accessibility tree. * @access public * @param {Number} index - index of the child to remove */ removeChildAt(index: number): void; /** * Requests that focus be sent to the DOM entry for associated DisplayObject * @access public */ requestFocus(): void; get reactProps(): Props; get htmlString(): string; /** * Sets whether keydown/keyup events should be sent to the DisplayObject. * The constructor default is that these events are not sent. * @access public * @param {boolean} enable - true if the keydown/keyup events should be sent to the DisplayObject. * false otherwise. */ set enableKeyEvents(enable: boolean); /** * Retrieves whether keydown/keyup events are currently configured to be * sent to the DisplayObject. * @access public * @returns {boolean} true if the keydown/keyup events should be sent to the DisplayObject. * false otherwise. */ get enableKeyEvents(): boolean; /** * Sets the keyboard shortcut to click the DisplayObject * @access public * @param {string} keycode - string containing the letter to use for the keyboard shortcut */ set accessKey(keycode: string); /** * Retrieves the keyboard shortcut to click the DisplayObject * @access public * @returns {string} string containing the letter to use for the keyboard shortcut */ get accessKey(): string; /** * The spellcheck attribute specifies whether the element is to have its spelling * and grammar checked or not. * @access public * @param { boolean } bool */ set spellcheck(bool: boolean); /** * The spellcheck attribute specifies whether the element is to have its spelling and * grammar checked or not. * @access public * @returns {boolean} boolean: true or false */ get spellcheck(): boolean; /** * Sets the title for the DisplayObject * @access public * @param {string} title - string mouse hover show text of title as tooltip */ set title(title: string); /** * Retrieves the title for the DisplayObject * @access public * @returns {string} string mouse hover show text of title as tooltip */ get title(): string; /** * The lang attribute specifies the language of the element's content. * @access public * @returns {string} lang: eg. "en" for English, "es" for Spanish, "fr" for French, and so on. * https://www.w3schools.com/tags/ref_language_codes.asp has the full list of valid values. */ get lang(): string; /** * The lang attribute specifies the language of the element's content. * @access public * @param {string} lang: eg. "en" for English, "es" for Spanish, "fr" for French, and so on. * https://www.w3schools.com/tags/ref_language_codes.asp has the full list of valid values. */ set lang(lang: string); /** * The dir attribute specifies the text direction of the element's content. * @access public * @param {string} direction * ltr: Left-to-right text direction, rtl: Right-to-left text direction * auto: Let the browser figure out the text direction, based on the content */ set dir(direction: string); /** * The dir attribute specifies the text direction of the element's content. * @access public * @returns {string} direction * ltr: Left-to-right text direction, rtl: Right-to-left text direction, auto: Let the browser * figure out the text direction, based on the content */ get dir(): string; /** * Sets whether ATs should present the region as a whole or parts * @access public * @param {boolean} enable - true if ATs should present the region as a whole, * false for parts. undefined to unset the field. */ set atomic(enable: boolean); /** * Retrieves whether ATs should present the region as a whole or parts * @access public * @returns {boolean} true if ATs should present the region as a whole, false * for parts, undefined if the field is unset. */ get atomic(): boolean; /** * Sets whether the element or its children in the accessibility tree are currently being updated * @access public * @param {boolean} updating - true if updating is in progress, false if there * are no more expected updates, undefined to unset the field. */ set busy(updating: boolean); /** * Retrieves whether the element or its children in the accessibility tree are * currently being updated * @access public * @returns {boolean} true if updating is in progress, false if there are no more * expected updates, undefined if the field is unset. */ get busy(): boolean; /** * Retrieves the array of DisplayObjects that are children of this one in the accessibility tree * @access public * @return {Array} array of child DisplayObjects */ get children(): AccessibleDisplayObject[]; /** * Sets which DisplayObject's contents or presence is controlled by this one. * @access public * @param {AccessibleDisplayObject} displayObject - DisplayObject controlled by this one. * undefined to unset the field. */ set controls(displayObject: AccessibleDisplayObject); /** * Retrieves which DisplayObject has their content or presence controlled by this one. * @access public * @returns {AccessibleDisplayObject} DisplayObject controlled by this one */ get controls(): AccessibleDisplayObject; /** * Retrieves the DOM id for the tranlated DisplayObject controlled by this one. * @access public * @returns {string} id for the translated controlled DisplayObject */ get controlsId(): string; /** * Sets which DisplayObject's accessibility information describes this one. * @access public * @param {AccessibleDisplayObject} displayObject - describing DisplayObject. * undefined to unset the field. */ set describedBy(displayObject: AccessibleDisplayObject); /** * Retrieves which DisplayObject has accessibility information describing this one. * @access public * @returns {AccessibleDisplayObject} describing DisplayObject */ get describedBy(): AccessibleDisplayObject; /** * Retrieves the DOM id of the translated DisplayObject that has accessibility information * describing this one. * @access public * @returns {string} id of the translated describing DisplayObject */ get describedById(): string; /** * Retrieves the DisplayObject that this AccessibilityObject instance provides * accessibility annotation for. * @access public * @returns {AccessibleDisplayObject} DisplayObject that this AccessibilityObject annotates */ get displayObject(): AccessibleDisplayObject; /** * Retrieves the value of the id attribute used in the DOM for the DisplayObject's accessibility * information * @access public * @returns {string} id of the DOM element */ get domId(): string; /** * Sets which drop effects can be performed when dropping a draggable object onto this one. See https://www.w3.org/TR/wai-aria/states_and_properties#aria-dropeffect for valid values * @access public * @param {string} effects - Space separate list of drop effects. undefined to unset this field. */ set dropEffects(effects: string); /** * Retrieves which drop effects can be performed when dropping a draggable object onto this one. * @access public * @returns {string} Space separate list of drop effects. undefined if this field is unset. */ get dropEffects(): string; /** * Sets whether the element is enabled * @access public * @param {boolean} enable - true if the element should be enabled, false * if the element should be disabled. undefined to unset the field. */ set enabled(enable: boolean); /** * Retrieves whether the element is enabled * @access public * @returns {boolean} true if the element is enabled, false if the element * is disabled. undefined if the field is unset. */ get enabled(): boolean; /** * Retrieves whether the DisplayObject is disabled for interaction, * taking into account the automatic field determination done when translating to the DOM. * @access public * @returns {boolean} true if disabled, false otherwise */ get disabledWithInference(): boolean; /** * Sets which DisplayObject is next in an alternative reading order * @access public * @param {AccessibleDisplayObject} displayObject - DisplayObject to flow to. * undefined to unset the field. */ set flowTo(displayObject: AccessibleDisplayObject); /** * Retrieves the DisplayObject that is next in the alternative reading order * @access public * @returns {AccessibleDisplayObject} DisplayObject to flow to */ get flowTo(): AccessibleDisplayObject; /** * Retrieves the DOM id of the translated DisplayObject that is next in an * alternative reading order * @access public * @returns {string} id to flow to */ get flowToId(): string; /** * Sets whether the DisplayObject is picked up for a drag and drop interaction * @access public * @param {boolean} dragging - true if being dragged, false for not being dragged but * supports it, undefined for not being dragged and doesn't support it */ set grabbed(dragging: boolean); /** * Retrieves whether the DisplayObject is picked up for a drag and drop interaction * @access public * @returns {boolean} true if being dragged, false for not being dragged but supports it, * undefined for not being dragged and doesn't support it */ get grabbed(): boolean; /** * Sets whether additional content will be displayed by interacting with the DisplayObject * @access public * @param {string | boolean} popup - see https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup for valid values. undefined to unset the field. */ set hasPopUp(popup: string | boolean); /** * Retrieves whether additional content will be displayed by interacting with the DisplayObject * @access public * @returns {string | boolean} see https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup for valid values. undefined if this field is unset. */ get hasPopUp(): string | boolean; /** * Sets whether the DisplayObject is perceivable to any type of user. * Note: if this field is unset (undefined) and the DisplayObject's .visible * field a falsey value, then the translated DOM entry will have 'aria-hidden' * set to true. If you want to prevent this automatic field determination, * then this field should be set to true or false. * @access public * @param {boolean} hide - true if not perceivable, false for perceivable. * undefined to unset the field. */ set hidden(hide: boolean); /** * Retrieves whether the DisplayObject is perceivable to any type of user. * @access public * @returns {boolean} true if not perceivable, false for perceivable. * undefined if this field is unset. */ get hidden(): boolean; /** * Retrieves whether the DisplayObject is perceivable to any type of user, * taking into account the automatic field determination done when translating to the DOM. * @access public * @returns {boolean} true if not perceivable, false for perceivable */ get hiddenWithInference(): boolean; /** * Sets if/how the entered value is considered invalid * @access public * @param {string} reason - A string from https://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid for why the entered value is considered invalid. undefined to unset the field. */ set invalid(reason: string); /** * Retrieves if/how the entered value is considered invalid * @access public * @returns {string} A string from https://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid for why the entered value is considered invalid. undefined if this field is unset. */ get invalid(): string; /** * Sets the string to use as a label * @access public * @param {string} str - string to use as a label. undefined if the field is to be cleared */ set label(str: string); /** * Retrieves the string that is used for label * @access public * @returns {string} the string label. undefined if this field is unset. */ get label(): string; /** * Sets which other DisplayObject labels the DisplayObject * @access public * @param {AccessibleDisplayObject} displayObject - DisplayObject that labels this one. * undefined if the field is to be cleared */ set labelledBy(displayObject: AccessibleDisplayObject); /** * Retrieves the DisplayObject that is used for labelling this one * @access public * @returns {AccessibleDisplayObject} DisplayObject that is used for a label. * undefined if this field is unset. */ get labelledBy(): AccessibleDisplayObject; /** * Retrieves the DOM id of the translated DisplayObject that is used for labelling this one * @access public * @returns {string} id of the label. undefined if this field is unset. */ get labelledById(): string; /** * Sets the priority level of the user being informed of updates to the translated * DOM element or its children * @access public * @param {string} level - See https://www.w3.org/TR/wai-aria/states_and_properties#aria-live for values and their meaning. undefined if the field is to be cleared */ set live(level: string); /** * Retrieves the priority level of the user being informed of updates to the translated * DOM element or its children * @access public * @returns {string} priority level. undefined if this field is unset. */ get live(): string; /** * Sets which DisplayObjects that are not children in the accessibility tree but have * a child relationship with this one * @access public * @param {Array} displayObjects - array of AccessibleDisplayObject that * should have a child relationship without being children in the accessibility tree. * undefined if the field is to be cleared */ set owns(displayObjects: AccessibleDisplayObject[]); /** * Retrieves which DisplayObjects that are not children in the accessibility tree but * have a child relationship with this one * @access public * @returns {Array} array of DisplayObjects that should have * a child relationship without being children in the accessibility tree. * undefined if this field is unset. */ get owns(): AccessibleDisplayObject[]; /** * Retrieves a space separated list of the DOM ids of the translated DisplayObjects * that are not children in the accessibility tree that have a child relationship with this one * @access public * @returns {string} space separate list of DOM ids. undefined if this field is unset. */ get ownsIds(): string; /** * Retrieves the AccessibilityObject that is this one's parent in an accessibility tree. * null if this is currently not in an accessibility tree. * @access public * @return {AccessibilityObject} Parent AccessibilityObject in an accessibility tree */ get parent(): AccessibilityObject; /** * Sets which notifications should be sent for live regions * @access public * @param {string} str - space separated list of values from https://www.w3.org/TR/wai-aria/states_and_properties#aria-relevant. undefined if the field is to be cleared */ set relevant(str: string); /** * Retrieves a space separated list of notifications for live regions. * @access public * @returns {string} space separated list of values. undefined if this field is unset. */ get relevant(): string; /** * Retrieves the entry in the ROLES enum for which ARIA role is used * @access public * @returns {string} string describing the DisplayObject to the AT */ get role(): string; /** * Sets the tab index for the DisplayObject * @access public * @param {number} index - number to use as the tab index */ set tabIndex(index: number); /** * Retrieves the tab index for the DisplayObject * @access public * @returns {Number} number used as the tab index */ get tabIndex(): number; /** * Sets whether the DisplayObject should be displayed in the DOM translation. * Note: if this field is unset (undefined) and the DisplayObject's .visible field * a falsey value, then the translated DOM entry will have 'display' set to 'none'. * If you want to prevent this automatic field determination, then this field should * be set to true or false. * @access public * @param {boolean} vis - true if DOM translation should be displayed, false for hidden. * undefined to unset the field. */ set visible(vis: boolean); /** * Retrieves whether the DisplayObject should be displayed in the DOM translation. * @access public * @returns {boolean} true if visible, false for hidden. undefined if this field is unset. */ get visible(): boolean; /** * Retrieves whether the DisplayObject is displayed in the DOM translation, taking into * account the automatic field determination done when translating to the DOM. * @access public * @returns {boolean} true if not visible, false if hidden */ get visibleWithInference(): boolean; /** * Makes the DOM entry visible immediately. This does not affect the value used * during the next render of the accessibility tree. * @access package */ _forceShow(): void; /** * Finds the index into this.children for the specified DOM id * @access package * @param {String} id - DOM id of the element to find * @returns {Number} index into this.children. -1 if no match is found */ _domIdToChildIndex(id: String): Number; /** * Event listener for keydown events * @access protected * @param {KeyboardEvent} evt - keyboard event */ _onKeyDown(evt: KeyboardEvent): void; /** * Event listener for keyup events * @access protected * @param {KeyboardEvent} evt - keyboard event */ _onKeyUp(evt: KeyboardEvent): void; } export {};