1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090 |
- (function() {
- // During the rave-accessibility.js build, this file is added to the top.
- // Create an inner self-executing function that will be run with the global scope
- // On browsers, this is 'window'. Everywhere else should use 'this' if available.
- // Need to run eval('this') "indirectly" by having eval returned by (1,eval). OBVIOUSLY :)
- var _window = (1, eval)('this');
- (function (global, factory) {
- // dynamically determine how 'rave' variable should be loaded depeneding on loader type
- var _rave;
- if (typeof module === "object" && typeof module.exports === "object" && typeof require == "function") {
- // CommonJS/node.js
- var rave = require("rave-navigation");
- var _accessibility = factory(global,rave);
- module.exports = rave;
- } else if (typeof define === "function" && define.amd) {
- // AMD
- define(['rave-navigation'], function(rave) {
- return factory(global,rave);
- });
- } else {
- // probably loading via script tag. run as is, setting stuff on rave
- factory(global,global['rave']);
- }
- }(_window, function (_global, _rave) {// $source: com/ibm/rave/accessibility/internal/nativeImpl/ModuleHeader
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // setup
- var global = typeof _global !== "undefined" ? _global : (1, eval)('this');
- var rave = typeof _rave !== "undefined" ? _rave : global['rave'];
- var rave_document = rave["_"]["rave_document"], rave_externs={},
- com_ibm_rave_core_Rave = rave,
- com_ibm_rave_core_nativeImpl_Declare = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"],
- com_ibm_rave_core_selector_Selector = rave["internal"]["Selector"],
- com_ibm_rave_core_selector_SelectorDelegate = rave["internal"]["SelectorDelegate"],
- com_ibm_rave_navigation_focus_FocusController = rave["navigation"]["internal"]["FocusController"],
- com_ibm_rave_core_context_RaveContextManager = rave["internal"]["RaveContextManager"],
- com_ibm_rave_navigation_Navigation = rave["navigation"];
- // $source: com/ibm/rave/accessibility/AccessibilityConstants
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- var com_ibm_rave_accessibility_AccessibilityConstants = rave_externs["AccessibilityConstants"] = {
- };
- /**
- * Key for the accessibility selector. To access accessibility methods on a selector, get the accessibility selector from the core selector this way: <code> AccessibilitySelector a11ySelector = (AccessibilitySelector) Rave.select("id").extension( Accessibility.SELECTOR_ID); </code>
- */
- /** @expose */
- com_ibm_rave_accessibility_AccessibilityConstants.SELECTOR_ID = "raveAccessibility";
- /**
- * Property key for accessible info. The accessible info must be of type {@link (Object) AccessibleInfo} .
- */
- /** @expose */
- com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY = "__accessibleInfo__";
- /**
- * Property key for shadow tree builder. The shadow tree builder must be of type {@link (com.ibm.rave.accessibility.ShadowTreeBuilder) ShadowTreeBuilder} .
- */
- /** @expose */
- com_ibm_rave_accessibility_AccessibilityConstants.SHADOW_TREE_BUILDER_KEY = "__shadowTreeBuilder__";
- // $source: com/ibm/rave/accessibility/internal/AccessibleNavigationSceneNodeExtension
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/Rave (static) // Rave
- //@import com/ibm/rave/accessibility/internal/AccessibilityUtil (runtime) // recursiveSetShadowTreeBuilder, getShadowTreeBuilder
- //@import com/ibm/rave/accessibility/AccessibilityConstants (runtime) // AccessibilityConstants
- var com_ibm_rave_accessibility_internal_AccessibleNavigationSceneNodeExtension = {
- //constructor : function() {}
- };
- com_ibm_rave_accessibility_internal_AccessibleNavigationSceneNodeExtension.extend = function(baseNode) {
- var oriAppendChild = baseNode.appendChild;
- baseNode.appendChild = function(node) {
- oriAppendChild.call(this, node);
- com_ibm_rave_core_Rave.configuration.extendRecursive(node);
- var builder = com_ibm_rave_accessibility_internal_AccessibilityUtil.getShadowTreeBuilder(this);
- if (builder) {
- com_ibm_rave_accessibility_internal_AccessibilityUtil.recursiveSetShadowTreeBuilder(node, builder);
- builder.onAppend(this, node);
- }
- };
- var oriInsertBefore = baseNode.insertBefore;
- baseNode.insertBefore = function(node, before) {
- oriInsertBefore.call(this, node, before);
- com_ibm_rave_core_Rave.configuration.extendRecursive(node);
- var builder = com_ibm_rave_accessibility_internal_AccessibilityUtil.getShadowTreeBuilder(this);
- if (builder) {
- com_ibm_rave_accessibility_internal_AccessibilityUtil.recursiveSetShadowTreeBuilder(node, builder);
- builder.onInsert(this, node, before);
- }
- };
- var oriRemoveChild = baseNode.removeChild;
- baseNode.removeChild = function(node) {
- var i = this.rave_getChildNodes().indexOf(node);
- if (i != -1) {
- oriRemoveChild.call(this, node);
- com_ibm_rave_core_Rave.configuration.extendRecursive(node);
- var builder = com_ibm_rave_accessibility_internal_AccessibilityUtil.getShadowTreeBuilder(node);
- if (builder) {
- builder.onRemove(this, node, i);
- com_ibm_rave_accessibility_internal_AccessibilityUtil.recursiveSetShadowTreeBuilder(node, null);
- }
- return true;
- }
- return false;
- };
- var oriSetProperty = baseNode.rave_setProperty;
- baseNode.rave_setProperty = function(key, value) {
- oriSetProperty.call(this, key, value);
- if (com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY == key) {
- var builder = com_ibm_rave_accessibility_internal_AccessibilityUtil.getShadowTreeBuilder(this);
- if (builder) {
- builder.onChange(this);
- }
- }
- };
- };
- com_ibm_rave_accessibility_internal_AccessibleNavigationSceneNodeExtension.register = function() {
- com_ibm_rave_core_Rave.configuration.addSceneNodeExtensionFactory("http://www.w3.org/2000/svg", function(node, context) {
- if ((context && context.rave_hasProperty(com_ibm_rave_accessibility_AccessibilityConstants.SHADOW_TREE_BUILDER_KEY)) || node.rave_hasProperty(com_ibm_rave_accessibility_AccessibilityConstants.SHADOW_TREE_BUILDER_KEY)) {
- com_ibm_rave_accessibility_internal_AccessibleNavigationSceneNodeExtension.extend(node);
- }
- }, 0);
- };
- // $source: com/ibm/rave/accessibility/internal/AccessibilityUtil
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/accessibility/AccessibilityConstants (static) // AccessibilityConstants
- //@import com/ibm/rave/core/selector/Selector (static) // extension
- //@import com/ibm/rave/accessibility/selector/AccessibilitySelector (runtime) // new
- var com_ibm_rave_accessibility_internal_AccessibilityUtil = {
- //constructor : function() {}
- };
- com_ibm_rave_accessibility_internal_AccessibilityUtil.getShadowTreeBuilder = function(node) {
- return node.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.SHADOW_TREE_BUILDER_KEY);
- };
- com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo = function(node) {
- return node.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY) != null;
- };
- com_ibm_rave_accessibility_internal_AccessibilityUtil.recursiveSetShadowTreeBuilder = function(node, builder) {
- node.rave_setProperty(com_ibm_rave_accessibility_AccessibilityConstants.SHADOW_TREE_BUILDER_KEY, builder);
- if (node.rave_hasChildNodes()) {
- for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
- __i_enFor0 < __len_enFor0; ++__i_enFor0) {
- var child = __exp_enFor0[__i_enFor0];
- com_ibm_rave_accessibility_internal_AccessibilityUtil.recursiveSetShadowTreeBuilder(child, builder);
- }
- }
- };
- com_ibm_rave_accessibility_internal_AccessibilityUtil.registerSelector = function() {
- com_ibm_rave_core_selector_Selector.extension(com_ibm_rave_accessibility_AccessibilityConstants.SELECTOR_ID, function() {
- return new com_ibm_rave_accessibility_selector_AccessibilitySelector();
- });
- };
- // $source: com/ibm/rave/accessibility/selector/AccessibilitySelector
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/core/selector/SelectorDelegate (loadtime) // superclass
- //@import com/ibm/rave/accessibility/internal/nativeImpl/AccessibleContext (runtime) // setDescription, getDescription
- //@import com/ibm/rave/accessibility/AccessibilityConstants (runtime) // AccessibilityConstants
- /**
- * Accessibility extension to {@link (com.ibm.rave.core.selector.SelectorDelegate) SelectorDelegate} . Adds the ability to perform accessibility related functions to a selector.
- */
- var com_ibm_rave_accessibility_selector_AccessibilitySelector = rave_externs["AccessibilitySelector"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_SelectorDelegate, {
- /**
- * Constructor
- */
- /** @expose */
- constructor : function() {},
- /**
- * Create the extension to the selector.
- * @param (com.ibm.rave.core.selector.Selector) s The core selector.
- * @return (com.ibm.rave.core.selector.Selector) The extended selector.
- */
- /** @expose */
- create : function(s) {
- var as = new com_ibm_rave_accessibility_selector_AccessibilitySelector();
- return as.setDelegate(s);
- },
- /**
- * Get the accessible description for the first SceneNode in this Selector. In JavaScript, this gets the "aria-label".
- * @return (String) the accessible description of the first SceneNode in this Selector
- */
- description$0 : function() {
- var node = this.node();
- var owner = node ? node.rave_getOwner() : null;
- return !owner ? null : com_ibm_rave_accessibility_internal_nativeImpl_AccessibleContext.getDescription(owner);
- },
- /**
- * Set an accessible description for each owner of SceneNode in this Selector. In JavaScript, this sets the "aria-label".
- * @param (String) description the description
- * @return (com.ibm.rave.accessibility.selector.AccessibilitySelector) this {@link (com.ibm.rave.accessibility.selector.AccessibilitySelector) AccessibilitySelector}
- */
- description$1 : function(description) {
- this.each$0(function(data, index, groupIndex) {
- var owner = this.rave_getOwner();
- if (owner) {
- com_ibm_rave_accessibility_internal_nativeImpl_AccessibleContext.setDescription(owner, description);
- if (description != null) {
- var info = owner.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY);
- if (!info) {
- info = {};
- info["label"] = description;
- owner.rave_setProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY, info);
- }
- }
- }
- });
- return this;
- },
- /**
- * Set an accessible description for each owner of SceneNode in this Selector. In JavaScript, this sets the "aria-label".
- * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function which returns a description
- * @return (com.ibm.rave.core.selector.Selector) this {@link (com.ibm.rave.accessibility.selector.AccessibilitySelector) AccessibilitySelector}
- */
- description$2 : function(valueFunction) {
- this.each$0(function(data, index, groupIndex) {
- var owner = this.rave_getOwner();
- if (owner) {
- var value = valueFunction.call(owner, owner.rave_getData(), index, groupIndex);
- var description = value != null ? value + "" : "";
- com_ibm_rave_accessibility_internal_nativeImpl_AccessibleContext.setDescription(owner, description);
- if (description != null) {
- var info = owner.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY);
- if (!info) {
- info = {};
- info["label"] = description;
- owner.rave_setProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY, info);
- }
- }
- }
- });
- return this;
- },
- /**
- * Get the accessible info for the first SceneNode in this Selector.
- * @return (Object) the accessible info of the first SceneNode in this Selector
- */
- info$0 : function() {
- var node = this.node();
- return !node ? null : node.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY);
- },
- /**
- * Set an accessible info for each SceneNode in this Selector.
- * @param (Object) info the accessible info
- * @return (com.ibm.rave.accessibility.selector.AccessibilitySelector) this {@link (com.ibm.rave.accessibility.selector.AccessibilitySelector) AccessibilitySelector}
- */
- info$1 : function(info) {
- this.each$0(function(data, index, groupIndex) {
- this.rave_setProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY, info);
- });
- return this;
- },
- /**
- * Set an accessible info for each SceneNode in this Selector.
- * @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function which returns a {@link (Object) AccessibleInfo}
- * @return (com.ibm.rave.accessibility.selector.AccessibilitySelector) this {@link (com.ibm.rave.accessibility.selector.AccessibilitySelector) AccessibilitySelector}
- */
- info$2 : function(valueFunction) {
- this.each$0(function(data, index, groupIndex) {
- this.rave_setProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY, valueFunction.call(this, data, index, groupIndex));
- });
- return this;
- },
- /** @expose */
- description : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.description$0();
- }
- if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
- return this.description$1(a0);
- }
- return this.description$2(a0);
- },
- /** @expose */
- info : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.info$0();
- }
- if (args.length == 1 && typeof a0 === "function") {
- return this.info$2(a0);
- }
- return this.info$1(a0);
- }
- });
- // $source: com/ibm/rave/accessibility/internal/nativeImpl/ShadowDOMBuilder
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014, 2015
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // @import com/ibm/rave/core/nativeImpl/Declare
- // @import com/ibm/rave/accessibility/AccessibilityConstants
- // @import com/ibm/rave/core/internal/nativeImpl/event/Event
- var com_ibm_rave_accessibility_internal_nativeImpl_ShadowDOMBuilder = (function() {
-
- var shadowDomNodeKey = "__shadowDomNode__";
- var sceneNodeKey = "__sceneNode__";
-
- function removeShadowDomNode(domNode) {
- if (domNode[shadowDomNodeKey]) {
- delete domNode[shadowDomNodeKey][sceneNodeKey];
- delete domNode[shadowDomNodeKey];
- }
- var childNodes = domNode.childNodes;
- for (var i = 0; i < childNodes.length; i++) {
- removeShadowDomNode(childNodes[i]);
- }
- }
-
- function setAttributes(shadowDomNode, info) {
- // set the known properties
- info["label"] ? shadowDomNode.setAttribute("aria-label", info["label"]) : shadowDomNode.removeAttribute("aria-label");
- info["hint"] ? shadowDomNode.setAttribute("aria-hint", info["hint"]) : shadowDomNode.removeAttribute("aria-hint");
- info["role"] ? shadowDomNode.setAttribute("role", info["role"]) : shadowDomNode.removeAttribute("role");
-
- // set all custom properties
- for (var key in info) {
- if (info.hasOwnProperty(key)) {
- switch (key) {
- case "label":
- case "hint":
- case "role":
- break;
- default:
- info[key] ? shadowDomNode.setAttribute(key, info[key]) : shadowDomNode.removeAttribute(key);
- }
- }
- }
-
- }
-
- function setText(shadowDomNode, info) {
- if (info && info["label"] && info["label"].length) {
- shadowDomNode.textContent = info["label"];
- }
- }
-
- function appendOrInsert(parent, child, before) {
- var info = child.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY);
-
- if (info) {
- var shadowDomNode = child.rave_getProperty(shadowDomNodeKey),
- ps = rave.select(parent.rave_getProperty(shadowDomNodeKey)),
- ul = ps.select("ul");
- if (!shadowDomNode) {
- if (ul.empty()) {
- ul = ps.append("ul");
- }
-
- shadowDomNode = rave_document.createElement("li");
- shadowDomNode[sceneNodeKey] = child;
- child.rave_setProperty(shadowDomNodeKey, shadowDomNode);
-
- setAttributes(shadowDomNode, info);
- setText(shadowDomNode, info);
-
- // recursively add its children
- if (child.rave_hasChildNodes()) {
- var children = child.rave_getChildNodes();
- for (var i = 0; i < children.length; i++) {
- this.onAppend(child, children[i]);
- }
- }
- }
-
- // get the real ul dom node
- ul = ul.node();
-
- if (arguments.length == 3) {
- ul.insertBefore(shadowDomNode, before.rave_getProperty(shadowDomNodeKey));
- } else {
- ul.appendChild(shadowDomNode);
- }
- }
- }
-
- return com_ibm_rave_core_nativeImpl_Declare({
- onAppend : appendOrInsert,
-
- onInsert : appendOrInsert,
-
- onRemove : function(parent, child, index) {
- var shadowDomNode = child[shadowDomNodeKey], newFocus;
- if (shadowDomNode == this._currentFocus) {
- newFocus = shadowDomNode.previousElementSibling;
- if (!newFocus) {
- newFocus = shadowDomNode.nextElementSibling;
- if (!newFocus) {
- // -> ul -> next parent
- newFocus = shadowDomNode.parentNode.parentNode;
- }
- }
- }
-
- this.tearDown(child);
-
- if (newFocus) {
- // select the scene node
- this._focusEventHandler.fireFocus(newFocus[sceneNodeKey]);
- }
- },
-
- onChange : function(domNode) {
- var info = domNode.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY),
- shadowDomNode = domNode.rave_getProperty(shadowDomNodeKey);
-
- if (!info) {
- // if no info remove the shadow dom node
- if (shadowDomNode) {
- this.tearDown(domNode);
- }
- } else if (!shadowDomNode) {
- var parentNode = domNode.parentNode;
- if (parentNode) {
- appendOrInsert(parentNode, domNode);
- }
- } else {
- // update attributes
- setAttributes(shadowDomNode, info);
-
- // cannot use #setText because text may be spread across multiple text nodes
- // remove all text nodes
- var childNodes = shadowDomNode.childNodes;
- for (var i = 0; i < childNodes.length; i++) {
- if (childNodes[i].nodeType == 3) {
- shadowDomNode.removeChild(childNodes[i]);
- }
- }
- if (info.label && info.label.length) {
- // add new text node
- shadowDomNode.insertBefore(rave_document.createTextNode(info.label), shadowDomNode.firstChild);
- }
- }
- },
-
- setUp : function(domNode, focusEventHandler) {
- this._focusEventHandler = focusEventHandler;
- var shadowDomNode = domNode[shadowDomNodeKey],
- info = domNode.rave_getProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY);
-
- if (!info) {
- info = {};
- domNode.rave_setProperty(com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY, info);
- }
-
- if (!shadowDomNode) {
- shadowDomNode = rave_document.createElement("div");
- shadowDomNode[sceneNodeKey] = domNode;
- shadowDomNode.setAttribute("class", "rave-a11y");
-
- rave.select(shadowDomNode).style({
- "width": 0,
- "height": 0,
- "left": -10000,
- "top": -10000,
- "position": "absolute",
- "overflow": "hidden"
- }, "important");
- domNode.parentNode.insertBefore(shadowDomNode, domNode);
- domNode[shadowDomNodeKey] = shadowDomNode;
-
- setAttributes(shadowDomNode, info);
- setText(shadowDomNode, info);
-
- if (domNode.rave_hasChildNodes()) {
- var children = domNode.rave_getChildNodes();
- for (var i = 0; i < children.length; i++) {
- this.onAppend(domNode, children[i]);
- }
- }
-
- // make the visualization focusable
- this._tabIndex = +domNode.getAttribute("tabindex");
- domNode.removeAttribute("tabindex");
-
- // set the current focus to the root shadow dom node
- this._currentFocus = shadowDomNode;
- this._currentFocus.setAttribute("tabindex", this._tabIndex);
- }
- },
-
- tearDown : function(domNode) {
- shadowDomNode = domNode[shadowDomNodeKey];
-
- if (shadowDomNode) {
- // remove from the DOM
- shadowDomNode.parentNode.removeChild(shadowDomNode);
- // remove stored data from the scene tree
- removeShadowDomNode(domNode);
- }
- },
-
- focus : function(domNode) {
- var shadowDomNode;
- if (domNode) {
- shadowDomNode = domNode[shadowDomNodeKey];
- }
- if (this._currentFocus != shadowDomNode) {
- var refocus = document.activeElement === this._currentFocus;
- if (this._currentFocus) {
- this._currentFocus.removeAttribute("tabindex");
- this._currentFocus.blur();
- }
- if (shadowDomNode) {
- shadowDomNode.setAttribute("tabindex", this._tabIndex);
- if (refocus) {
- shadowDomNode.focus();
- }
- }
- this._currentFocus = shadowDomNode;
- }
- }
- });
- })();
- // $source: com/ibm/rave/accessibility/internal/nativeImpl/AccessibleContext
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // Utility to setup accessible context on a scene node
- // @import ./ShadowDOMBuilder
- var com_ibm_rave_accessibility_internal_nativeImpl_AccessibleContext = {
- getDescription : function(node) {
- return node.getAttribute("aria-label");
- },
-
- setDescription : function(node, description) {
- node.setAttribute("aria-label", description);
- },
-
- createShadowTreeBuilder : function() {
- return new com_ibm_rave_accessibility_internal_nativeImpl_ShadowDOMBuilder();
- }
- };
- // $source: com/ibm/rave/accessibility/navigation/AccessibleNavigation
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/accessibility/navigation/AccessibleKeyboard (runtime) // new
- var com_ibm_rave_accessibility_navigation_AccessibleNavigation = com_ibm_rave_core_nativeImpl_Declare({
- /**
- * Creates a new instance of {@link (com.ibm.rave.accessibility.navigation.AccessibleKeyboard) AccessibleKeyboard} .
- * @return (com.ibm.rave.accessibility.navigation.AccessibleKeyboard) new instance of {@link (com.ibm.rave.accessibility.navigation.AccessibleKeyboard) AccessibleKeyboard}
- */
- /** @expose */
- keyboard : function() {
- return new com_ibm_rave_accessibility_navigation_AccessibleKeyboard();
- }
- //constructor : function() {}
- });
- /** @expose */
- com_ibm_rave_accessibility_navigation_AccessibleNavigation.INSTANCE = new com_ibm_rave_accessibility_navigation_AccessibleNavigation();
- // $source: com/ibm/rave/accessibility/Accessibility
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager
- //@import com/ibm/rave/accessibility/internal/AccessibleNavigationSceneNodeExtension (static) // register
- //@import com/ibm/rave/accessibility/internal/AccessibilityUtil (static) // registerSelector
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/accessibility/AccessibilityConstants (static) // AccessibilityConstants
- //@import com/ibm/rave/accessibility/navigation/AccessibleNavigation (static) // AccessibleNavigation
- /**
- * The accessibility layer. Provides entry points into functionality provided by the accessibility layer.
- */
- var com_ibm_rave_accessibility_Accessibility = rave_externs["Accessibility"] = {
- //constructor : function() {}
- };
- com_ibm_rave_accessibility_Accessibility.getRegistrationStatus = function() {
- var registrationStatus = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("ACCESSIBILITY_EXTENSION_REGISTRATION_STATUS_KEY");
- if (!registrationStatus) {
- registrationStatus = new com_ibm_rave_accessibility_Accessibility.RegistrationStatus();
- com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("ACCESSIBILITY_EXTENSION_REGISTRATION_STATUS_KEY", registrationStatus);
- }
- return registrationStatus;
- };
- /**
- * Initialize the Accessibility feature. This needs to be called before using any accessibility features.
- */
- /** @expose */
- com_ibm_rave_accessibility_Accessibility.init = function() {
- var registrationStatus = com_ibm_rave_accessibility_Accessibility.getRegistrationStatus();
- if (!registrationStatus.registered) {
- com_ibm_rave_accessibility_internal_AccessibleNavigationSceneNodeExtension.register();
- com_ibm_rave_accessibility_internal_AccessibilityUtil.registerSelector();
- registrationStatus.registered = true;
- }
- };
- com_ibm_rave_accessibility_Accessibility.RegistrationStatus = com_ibm_rave_core_nativeImpl_Declare({
- registered : false
- });
- //com_ibm_rave_accessibility_Accessibility.EXTENSION_REGISTRATION_STATUS_KEY = "ACCESSIBILITY_EXTENSION_REGISTRATION_STATUS_KEY";
- /**
- * @see this.AccessibilityConstants#com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY
- */
- /** @expose */
- com_ibm_rave_accessibility_Accessibility.ACCESSIBLE_INFO_KEY = com_ibm_rave_accessibility_AccessibilityConstants.ACCESSIBLE_INFO_KEY;
- /**
- * @see this.AccessibilityConstants#com_ibm_rave_accessibility_AccessibilityConstants.SHADOW_TREE_BUILDER_KEY
- */
- /** @expose */
- com_ibm_rave_accessibility_Accessibility.SHADOW_TREE_BUILDER_KEY = com_ibm_rave_accessibility_AccessibilityConstants.SHADOW_TREE_BUILDER_KEY;
- /**
- * @see this.AccessibilityConstants#com_ibm_rave_accessibility_AccessibilityConstants.SELECTOR_ID
- */
- /** @expose */
- com_ibm_rave_accessibility_Accessibility.SELECTOR_ID = com_ibm_rave_accessibility_AccessibilityConstants.SELECTOR_ID;
- /**
- * @see (com.ibm.rave.accessibility.navigation.AccessibleNavigation) AccessibleNavigation
- */
- /** @expose */
- com_ibm_rave_accessibility_Accessibility.navigation = com_ibm_rave_accessibility_navigation_AccessibleNavigation.INSTANCE;
- // $source: com/ibm/rave/accessibility/internal/nativeImpl/Module
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2014
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // @OnDemandLoad("rave-accessibility")
- // Must be the first import
- // @import ./ModuleHeader
- // Other module dependencies
- // @import com/ibm/rave/navigation/internal/nativeImpl/Module
- // @import com/ibm/rave/accessibility/Accessibility
- com_ibm_rave_accessibility_Accessibility.init();
- // expose a11y class to the global variable rave
- rave["accessibility"] = com_ibm_rave_accessibility_Accessibility;
- // $source: com/ibm/rave/accessibility/navigation/AccessibleKeyboard
- /************************************************************************
- ** IBM Confidential
- **
- ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
- **
- ** (C) Copyright IBM Corp. 2017
- **
- ** The source code for this program is not published or otherwise divested of its trade secrets,
- ** irrespective of what has been deposited with the U.S. Copyright Office.
- ************************************************************************/
- // GENERATED
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@import com/ibm/rave/navigation/Navigation (runtime) // keybinding
- //@import com/ibm/rave/core/Rave (runtime) // select, Rave
- //@import com/ibm/rave/accessibility/internal/nativeImpl/AccessibleContext (runtime) // createShadowTreeBuilder
- //@import com/ibm/rave/navigation/focus/FocusController (runtime) // nextFocusableNode, nextFocusableNodeFromStart, previousFocusableNodeFromEnd, nextLevelFocusableNode, previousLevelFocusableNode, previousFocusableNode
- //@import com/ibm/rave/accessibility/internal/AccessibilityUtil (runtime) // recursiveSetShadowTreeBuilder, hasAccessibleInfo, getShadowTreeBuilder
- var com_ibm_rave_accessibility_navigation_AccessibleKeyboard = rave_externs["AccessibleKeyboard"] = com_ibm_rave_core_nativeImpl_Declare({
- //kb : null,
- //eventHandler : null,
- //treeBuilder : null,
- //next : null,
- //previous : null,
- //nextStep : null,
- //previousStep : null,
- //first : null,
- //last : null,
- //nextLevel : null,
- //previousLevel : null,
- _$functionClassMethod : function() {
- var _$self = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- _$self.bind(args[0]);
- return null;
- }
- };
- return _$self;
- },
- constructor : function() {
- this.kb = com_ibm_rave_navigation_Navigation.keybinding();
- this.eventHandler = com_ibm_rave_core_Rave.behavior.focusEventHandler();
- this.treeBuilder = function(data, index, groupIndex) {
- return com_ibm_rave_accessibility_internal_nativeImpl_AccessibleContext.createShadowTreeBuilder();
- };
- {
- var self = this;
- this.next = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused && !(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot(focused))) {
- var nextSibling = focused;
- while ((nextSibling = com_ibm_rave_navigation_focus_FocusController.nextFocusableNode(nextSibling))) {
- if (com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(nextSibling)) {
- self.eventHandler.fireFocus(nextSibling);
- break;
- }
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- this.previous = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused && !(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot(focused))) {
- var previousSibling = focused;
- while ((previousSibling = com_ibm_rave_navigation_focus_FocusController.previousFocusableNode(previousSibling))) {
- if (com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(previousSibling)) {
- self.eventHandler.fireFocus(previousSibling);
- break;
- }
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- this.nextStep = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused && !(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot(focused))) {
- var stepCount = 0;
- var nextSibling = focused, temp = focused;
- while (stepCount < 20 && temp) {
- temp = com_ibm_rave_navigation_focus_FocusController.nextFocusableNode(temp);
- if (temp) {
- if (com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(temp)) {
- nextSibling = temp;
- stepCount++;
- }
- }
- }
- if (nextSibling != focused) {
- self.eventHandler.fireFocus(nextSibling);
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- this.previousStep = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused && !(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot(focused))) {
- var stepCount = 0;
- var previousSibling = focused, temp = focused;
- while (stepCount < 20 && temp) {
- temp = com_ibm_rave_navigation_focus_FocusController.previousFocusableNode(temp);
- if (temp) {
- if (com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(temp)) {
- previousSibling = temp;
- stepCount++;
- }
- }
- }
- if (previousSibling != focused) {
- self.eventHandler.fireFocus(previousSibling);
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- this.first = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused && !(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot(focused))) {
- var firstNode = com_ibm_rave_navigation_focus_FocusController.nextFocusableNodeFromStart(focused);
- if (!(com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(firstNode))) {
- while ((firstNode = com_ibm_rave_navigation_focus_FocusController.nextFocusableNode(firstNode))) {
- if (com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(firstNode)) {
- break;
- }
- }
- }
- if (firstNode && focused != firstNode) {
- self.eventHandler.fireFocus(firstNode);
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- this.last = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused && !(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot(focused))) {
- var lastNode = com_ibm_rave_navigation_focus_FocusController.previousFocusableNodeFromEnd(focused);
- if (!(com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(lastNode))) {
- while ((lastNode = com_ibm_rave_navigation_focus_FocusController.previousFocusableNode(lastNode))) {
- if (com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(lastNode)) {
- break;
- }
- }
- }
- if (lastNode && focused != lastNode) {
- self.eventHandler.fireFocus(lastNode);
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- this.nextLevel = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused) {
- if (focused.rave_hasChildNodes()) {
- var child = com_ibm_rave_navigation_focus_FocusController.nextLevelFocusableNode(focused);
- if (!(com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(child))) {
- while ((child = com_ibm_rave_navigation_focus_FocusController.nextFocusableNode(child))) {
- if (com_ibm_rave_accessibility_internal_AccessibilityUtil.hasAccessibleInfo(child)) {
- break;
- }
- }
- }
- if (child) {
- self.eventHandler.fireFocus(child);
- }
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- this.previousLevel = function(args) {
- if (args !== null || arguments.length > 1){
- args = Array.prototype.slice.call(arguments, 0);
- }
- {
- var focused = self.eventHandler.focusedNode;
- if (focused && !(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot(focused))) {
- var parent = com_ibm_rave_navigation_focus_FocusController.previousLevelFocusableNode(focused);
- if (parent) {
- self.eventHandler.fireFocus(parent);
- }
- }
- rave.event.preventDefault();
- return null;
- }
- };
- }
- {
- this.kb.on(40, this.next).on(38, this.previous).on(34, this.nextStep).on(33, this.previousStep).on(36, this.first).on(35, this.last).on(39, this.nextLevel).on(37, this.previousLevel);
- }
- },
- /** @expose */
- bind : function(g) {
- var self = this;
- g.each(function(data, index, groupIndex) {
- var s = com_ibm_rave_core_Rave.select(this);
- var stb = self.treeBuilder.call(this, data, index, groupIndex);
- com_ibm_rave_accessibility_internal_AccessibilityUtil.recursiveSetShadowTreeBuilder(this, stb);
- com_ibm_rave_core_Rave.configuration.extendRecursive(this);
- stb.setUp(this, self.eventHandler);
- s.on("ravefocus", com_ibm_rave_accessibility_navigation_AccessibleKeyboard.FOCUS_LISTENER);
- com_ibm_rave_core_Rave.select(this.rave_getOwner()).call(self.kb);
- s.property(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.NATIVATION_ROOT, true);
- self.eventHandler.focusedNode = this;
- });
- },
- shadowTreeBuilder$0 : function() {
- return this.treeBuilder;
- },
- shadowTreeBuilder$1 : function(shadowTreeBuilder) {
- this.treeBuilder = shadowTreeBuilder;
- return this;
- },
- /** @expose */
- keyBinding : function() {
- return this.kb;
- },
- focusEventHandler$0 : function() {
- return this.eventHandler;
- },
- focusEventHandler$1 : function(handler) {
- this.eventHandler = handler;
- return this;
- },
- /** @expose */
- shadowTreeBuilder : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.shadowTreeBuilder$0();
- }
- return this.shadowTreeBuilder$1(a0);
- },
- /** @expose */
- focusEventHandler : function(a0) {
- var args = arguments;
- if (args.length == 0) {
- return this.focusEventHandler$0();
- }
- return this.focusEventHandler$1(a0);
- }
- });
- com_ibm_rave_accessibility_navigation_AccessibleKeyboard.isNavigationRoot = function(item) {
- return item.rave_getProperty(com_ibm_rave_accessibility_navigation_AccessibleKeyboard.NATIVATION_ROOT) != null;
- };
- com_ibm_rave_accessibility_navigation_AccessibleKeyboard.NATIVATION_ROOT = "__rave-kbnav-root__";
- com_ibm_rave_accessibility_navigation_AccessibleKeyboard.STEP = 20;
- com_ibm_rave_accessibility_navigation_AccessibleKeyboard.FOCUS_LISTENER = function(data, index, groupIndex, event) {
- var stb = com_ibm_rave_accessibility_internal_AccessibilityUtil.getShadowTreeBuilder(event.target);
- if (event.target) {
- stb.focus(event.target);
- } else {
- stb.focus(null);
- }
- };
- // This is the end of the factory method defined in the header. Added only during a full compiled JS build.
- return rave;
- }));})();
|