@github/tab-container-element
Advanced tools
Comparing version 3.0.8 to 3.0.9
@@ -37,2 +37,18 @@ export default class TabContainerElement extends HTMLElement { | ||
connectedCallback() { | ||
for (const tab of this.querySelectorAll('[role="tablist"] [role="tab"]')) { | ||
if (!tab.hasAttribute('aria-selected')) { | ||
tab.setAttribute('aria-selected', 'false'); | ||
} | ||
if (!tab.hasAttribute('tabindex')) { | ||
if (tab.getAttribute('aria-selected') === 'true') { | ||
tab.setAttribute('tabindex', '0'); | ||
} else { | ||
tab.setAttribute('tabindex', '-1'); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
@@ -61,7 +77,10 @@ | ||
panel.hidden = true; | ||
panel.setAttribute('tabindex', '0'); | ||
if (!panel.hasAttribute('tabindex') && !panel.hasAttribute('data-tab-container-no-tabstop')) { | ||
panel.setAttribute('tabindex', '0'); | ||
} | ||
} | ||
selectedTab.setAttribute('aria-selected', 'true'); | ||
selectedTab.removeAttribute('tabindex'); | ||
selectedTab.setAttribute('tabindex', '0'); | ||
selectedTab.focus(); | ||
@@ -68,0 +87,0 @@ selectedPanel.hidden = false; |
@@ -13,3 +13,3 @@ (function (global, factory) { | ||
} | ||
})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { | ||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { | ||
"use strict"; | ||
@@ -58,2 +58,18 @@ | ||
connectedCallback() { | ||
for (const tab of this.querySelectorAll('[role="tablist"] [role="tab"]')) { | ||
if (!tab.hasAttribute('aria-selected')) { | ||
tab.setAttribute('aria-selected', 'false'); | ||
} | ||
if (!tab.hasAttribute('tabindex')) { | ||
if (tab.getAttribute('aria-selected') === 'true') { | ||
tab.setAttribute('tabindex', '0'); | ||
} else { | ||
tab.setAttribute('tabindex', '-1'); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
@@ -84,7 +100,10 @@ | ||
panel.hidden = true; | ||
panel.setAttribute('tabindex', '0'); | ||
if (!panel.hasAttribute('tabindex') && !panel.hasAttribute('data-tab-container-no-tabstop')) { | ||
panel.setAttribute('tabindex', '0'); | ||
} | ||
} | ||
selectedTab.setAttribute('aria-selected', 'true'); | ||
selectedTab.removeAttribute('tabindex'); | ||
selectedTab.setAttribute('tabindex', '0'); | ||
selectedTab.focus(); | ||
@@ -91,0 +110,0 @@ selectedPanel.hidden = false; |
{ | ||
"name": "@github/tab-container-element", | ||
"version": "3.0.8", | ||
"version": "3.0.9", | ||
"description": "Tab container element", | ||
@@ -27,10 +27,10 @@ "main": "dist/index.umd.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.0", | ||
"@babel/core": "^7.7.0", | ||
"@babel/plugin-transform-modules-umd": "^7.7.0", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.8.7", | ||
"@babel/plugin-transform-modules-umd": "^7.8.3", | ||
"babel-preset-github": "^3.2.1", | ||
"chai": "^4.2.0", | ||
"eslint": "^6.6.0", | ||
"eslint-plugin-github": "^3.2.1", | ||
"flow-bin": "^0.111.1", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-github": "^3.4.1", | ||
"flow-bin": "^0.120.1", | ||
"karma": "^4.4.1", | ||
@@ -41,3 +41,3 @@ "karma-chai": "^0.1.0", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"mocha": "^6.2.2" | ||
"mocha": "^7.1.0" | ||
}, | ||
@@ -44,0 +44,0 @@ "eslintIgnore": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11785
202