@y14e/tabs 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -389,6 +389,7 @@ var Tabs = class _Tabs {
|
|
|
389
389
|
}
|
|
390
390
|
addTokenToAttribute(panel, "aria-labelledby", tab.id);
|
|
391
391
|
tab.addEventListener("click", this.#onTabClick, { signal });
|
|
392
|
+
tab.addEventListener("focusin", this.#onTabFocusIn, { signal });
|
|
392
393
|
tab.addEventListener("keydown", this.#onTabKeyDown, { signal });
|
|
393
394
|
});
|
|
394
395
|
this.#indicatorElements.forEach((indicator) => {
|
|
@@ -417,6 +418,16 @@ var Tabs = class _Tabs {
|
|
|
417
418
|
}
|
|
418
419
|
this.activate(tab);
|
|
419
420
|
};
|
|
421
|
+
#onTabFocusIn = (event) => {
|
|
422
|
+
const tab = event.currentTarget;
|
|
423
|
+
if (!(tab instanceof HTMLElement)) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (this.#isAvoidedTab(tab)) {
|
|
427
|
+
const active = getActiveElement();
|
|
428
|
+
active && "blur" in active && typeof active.blur === "function" && active.blur();
|
|
429
|
+
}
|
|
430
|
+
};
|
|
420
431
|
#onTabKeyDown = (event) => {
|
|
421
432
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
422
433
|
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
@@ -630,7 +641,7 @@ function isFocusable(element) {
|
|
|
630
641
|
* Tabs
|
|
631
642
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
632
643
|
*
|
|
633
|
-
* @version 1.3.
|
|
644
|
+
* @version 1.3.8
|
|
634
645
|
* @author Yusuke Kamiyamane
|
|
635
646
|
* @license MIT
|
|
636
647
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -387,6 +387,7 @@ var Tabs = class _Tabs {
|
|
|
387
387
|
}
|
|
388
388
|
addTokenToAttribute(panel, "aria-labelledby", tab.id);
|
|
389
389
|
tab.addEventListener("click", this.#onTabClick, { signal });
|
|
390
|
+
tab.addEventListener("focusin", this.#onTabFocusIn, { signal });
|
|
390
391
|
tab.addEventListener("keydown", this.#onTabKeyDown, { signal });
|
|
391
392
|
});
|
|
392
393
|
this.#indicatorElements.forEach((indicator) => {
|
|
@@ -415,6 +416,16 @@ var Tabs = class _Tabs {
|
|
|
415
416
|
}
|
|
416
417
|
this.activate(tab);
|
|
417
418
|
};
|
|
419
|
+
#onTabFocusIn = (event) => {
|
|
420
|
+
const tab = event.currentTarget;
|
|
421
|
+
if (!(tab instanceof HTMLElement)) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (this.#isAvoidedTab(tab)) {
|
|
425
|
+
const active = getActiveElement();
|
|
426
|
+
active && "blur" in active && typeof active.blur === "function" && active.blur();
|
|
427
|
+
}
|
|
428
|
+
};
|
|
418
429
|
#onTabKeyDown = (event) => {
|
|
419
430
|
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
420
431
|
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
@@ -628,7 +639,7 @@ function isFocusable(element) {
|
|
|
628
639
|
* Tabs
|
|
629
640
|
* WAI-ARIA compliant tabs pattern implementation in TypeScript.
|
|
630
641
|
*
|
|
631
|
-
* @version 1.3.
|
|
642
|
+
* @version 1.3.8
|
|
632
643
|
* @author Yusuke Kamiyamane
|
|
633
644
|
* @license MIT
|
|
634
645
|
* @copyright Copyright (c) Yusuke Kamiyamane
|