@juspay/svelte-ui-components 4.55.0 → 4.55.1
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.
|
@@ -43,7 +43,8 @@ export declare function getFocusTrapBoundary(container: ParentNode | null): Focu
|
|
|
43
43
|
* element focus should move to, or null when the default browser behavior
|
|
44
44
|
* (move to the next/previous focusable element) should be left alone.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
46
|
+
* An empty panel keeps focus on itself when it is already the active element.
|
|
47
|
+
* Otherwise wrapping only happens exactly at an edge: focus sits on the last focusable
|
|
47
48
|
* element and Tab (not Shift+Tab) was pressed, or focus sits on the first and
|
|
48
49
|
* Shift+Tab was pressed. Anywhere else in the middle of the tab order, the
|
|
49
50
|
* browser's own handling is correct and this returns null.
|
|
@@ -95,7 +95,8 @@ export function getFocusTrapBoundary(container) {
|
|
|
95
95
|
* element focus should move to, or null when the default browser behavior
|
|
96
96
|
* (move to the next/previous focusable element) should be left alone.
|
|
97
97
|
*
|
|
98
|
-
*
|
|
98
|
+
* An empty panel keeps focus on itself when it is already the active element.
|
|
99
|
+
* Otherwise wrapping only happens exactly at an edge: focus sits on the last focusable
|
|
99
100
|
* element and Tab (not Shift+Tab) was pressed, or focus sits on the first and
|
|
100
101
|
* Shift+Tab was pressed. Anywhere else in the middle of the tab order, the
|
|
101
102
|
* browser's own handling is correct and this returns null.
|
|
@@ -103,7 +104,14 @@ export function getFocusTrapBoundary(container) {
|
|
|
103
104
|
export function focusTrapTabTarget(params) {
|
|
104
105
|
const { first, last } = getFocusTrapBoundary(params.container);
|
|
105
106
|
if (first === null || last === null) {
|
|
106
|
-
|
|
107
|
+
// focusEntryPoint focuses the panel itself when it has no controls. Keep
|
|
108
|
+
// that panel, but never take focus from another (possibly nested) layer.
|
|
109
|
+
const active = params.activeElement;
|
|
110
|
+
return active === params.container &&
|
|
111
|
+
typeof HTMLElement === 'function' &&
|
|
112
|
+
active instanceof HTMLElement
|
|
113
|
+
? active
|
|
114
|
+
: null;
|
|
107
115
|
}
|
|
108
116
|
const edge = params.shiftKey ? first : last;
|
|
109
117
|
if (params.activeElement !== edge) {
|
package/dist-wc/index.js
CHANGED
|
@@ -7158,7 +7158,10 @@ function getFocusTrapBoundary(e) {
|
|
|
7158
7158
|
}
|
|
7159
7159
|
function focusTrapTabTarget(e) {
|
|
7160
7160
|
let { first: t, last: n } = getFocusTrapBoundary(e.container);
|
|
7161
|
-
if (t === null || n === null)
|
|
7161
|
+
if (t === null || n === null) {
|
|
7162
|
+
let t = e.activeElement;
|
|
7163
|
+
return t === e.container && typeof HTMLElement == "function" && t instanceof HTMLElement ? t : null;
|
|
7164
|
+
}
|
|
7162
7165
|
let i = e.shiftKey ? t : n;
|
|
7163
7166
|
return e.activeElement === i ? e.shiftKey ? n : t : null;
|
|
7164
7167
|
}
|