@juspay/svelte-ui-components 4.55.2 → 4.55.3

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.
@@ -31,8 +31,9 @@ const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disab
31
31
  /**
32
32
  * True when `el` can actually take focus. `FOCUSABLE_SELECTOR` alone matches
33
33
  * candidates that pass its tag/attribute shape but still cannot receive
34
- * focus in a real browser: hidden via the `hidden` attribute, inside an
35
- * `inert` subtree, or explicitly marked `aria-disabled="true"`. Without this,
34
+ * focus in a real browser: an input with type="hidden", hidden via the
35
+ * `hidden` attribute, inside an `inert` subtree, or explicitly marked
36
+ * `aria-disabled="true"`. Without this,
36
37
  * Tab wrapping can land focus on one of these -- worse than no trap at all,
37
38
  * since focus then effectively vanishes instead of just not being managed.
38
39
  *
@@ -46,7 +47,7 @@ const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disab
46
47
  * jsdom, which the test suite runs under, never computes layout, so a
47
48
  * layout-based check would either be a permanent no-op there or -- worse --
48
49
  * report every element as non-focusable and empty out every boundary under
49
- * test. The three checks below are all attribute/tree-shape reads, which
50
+ * test. The checks below are all attribute/tree-shape reads, which
50
51
  * jsdom does support, so behavior under test matches behavior in a browser.
51
52
  */
52
53
  function canReceiveFocus(el) {
@@ -55,6 +56,10 @@ function canReceiveFocus(el) {
55
56
  typeof el.closest !== 'function') {
56
57
  return true;
57
58
  }
59
+ if (el.tagName?.toLowerCase() === 'input' &&
60
+ el.getAttribute('type')?.toLowerCase() === 'hidden') {
61
+ return false;
62
+ }
58
63
  if (el.hasAttribute('hidden')) {
59
64
  return false;
60
65
  }
package/dist-wc/index.js CHANGED
@@ -7135,7 +7135,7 @@ function unlockBodyScroll() {
7135
7135
  //#region src/lib/_interaction/focus.ts
7136
7136
  var FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
7137
7137
  function canReceiveFocus(e) {
7138
- return typeof e.hasAttribute != "function" || typeof e.getAttribute != "function" || typeof e.closest != "function" ? !0 : e.hasAttribute("hidden") || e.getAttribute("aria-disabled") === "true" ? !1 : e.closest("[inert]") === null;
7138
+ return typeof e.hasAttribute != "function" || typeof e.getAttribute != "function" || typeof e.closest != "function" ? !0 : e.tagName?.toLowerCase() === "input" && e.getAttribute("type")?.toLowerCase() === "hidden" || e.hasAttribute("hidden") || e.getAttribute("aria-disabled") === "true" ? !1 : e.closest("[inert]") === null;
7139
7139
  }
7140
7140
  function collectFocusableCandidates(e) {
7141
7141
  let t = e.querySelectorAll(FOCUSABLE_SELECTOR), n = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "4.55.2",
3
+ "version": "4.55.3",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",