VulpesOS/gaia/shared/js/accessibility_helper.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

23 lines
691 B
JavaScript
Executable file

'use strict';
(function(exports) {
var AccessibilityHelper = {
/**
* For a set of tab elements, set aria-selected attribute in accordance with
* the current selection.
* @param {Object} selectedTab a tab to select object.
* @param {Array} tabs an array of tabs.
*/
setAriaSelected: function ah_setAriaSelected(selectedTab, tabs) {
// In case tabs is a NodeList, that does not have forEach.
Array.prototype.forEach.call(tabs, function setAriaSelectedAttr(tab) {
tab.setAttribute('aria-selected',
tab === selectedTab ? 'true' : 'false');
});
}
};
exports.AccessibilityHelper = AccessibilityHelper;
})(window);