@aurodesignsystem-dev/auro-formkit 0.0.0-pr1552.0 → 0.0.0-pr1553.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.
Files changed (45) hide show
  1. package/components/checkbox/demo/customize.min.js +1 -1
  2. package/components/checkbox/demo/getting-started.min.js +1 -1
  3. package/components/checkbox/demo/index.min.js +1 -1
  4. package/components/checkbox/dist/index.js +1 -1
  5. package/components/checkbox/dist/registered.js +1 -1
  6. package/components/combobox/demo/customize.min.js +46 -207
  7. package/components/combobox/demo/getting-started.min.js +46 -207
  8. package/components/combobox/demo/index.min.js +46 -207
  9. package/components/combobox/dist/index.js +46 -207
  10. package/components/combobox/dist/registered.js +46 -207
  11. package/components/counter/demo/customize.min.js +59 -222
  12. package/components/counter/demo/index.min.js +59 -222
  13. package/components/counter/dist/auro-counter.d.ts +0 -8
  14. package/components/counter/dist/index.js +59 -222
  15. package/components/counter/dist/registered.js +59 -222
  16. package/components/datepicker/demo/customize.min.js +46 -207
  17. package/components/datepicker/demo/index.min.js +46 -207
  18. package/components/datepicker/dist/index.js +46 -207
  19. package/components/datepicker/dist/registered.js +46 -207
  20. package/components/dropdown/demo/customize.min.js +44 -205
  21. package/components/dropdown/demo/getting-started.min.js +44 -205
  22. package/components/dropdown/demo/index.min.js +44 -205
  23. package/components/dropdown/dist/index.js +44 -205
  24. package/components/dropdown/dist/registered.js +44 -205
  25. package/components/form/demo/customize.min.js +199 -845
  26. package/components/form/demo/getting-started.min.js +199 -845
  27. package/components/form/demo/index.min.js +199 -845
  28. package/components/form/demo/registerDemoDeps.min.js +199 -845
  29. package/components/input/demo/customize.min.js +1 -1
  30. package/components/input/demo/getting-started.min.js +1 -1
  31. package/components/input/demo/index.min.js +1 -1
  32. package/components/input/dist/index.js +1 -1
  33. package/components/input/dist/registered.js +1 -1
  34. package/components/radio/demo/customize.min.js +1 -1
  35. package/components/radio/demo/getting-started.min.js +1 -1
  36. package/components/radio/demo/index.min.js +1 -1
  37. package/components/radio/dist/index.js +1 -1
  38. package/components/radio/dist/registered.js +1 -1
  39. package/components/select/demo/customize.min.js +45 -206
  40. package/components/select/demo/getting-started.min.js +45 -206
  41. package/components/select/demo/index.min.js +45 -206
  42. package/components/select/dist/index.js +45 -206
  43. package/components/select/dist/registered.js +45 -206
  44. package/custom-elements.json +1499 -1514
  45. package/package.json +2 -2
@@ -1064,7 +1064,7 @@ let AuroHelpText$1 = class AuroHelpText extends LitElement {
1064
1064
  }
1065
1065
  };
1066
1066
 
1067
- var formkitVersion$1 = '202607092329';
1067
+ var formkitVersion$1 = '202607102138';
1068
1068
 
1069
1069
  // Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
1070
1070
  // See LICENSE in the project root for license information.
@@ -1405,21 +1405,6 @@ class AuroCounter extends LitElement {
1405
1405
  }
1406
1406
  }
1407
1407
 
1408
- /**
1409
- * Handles the slotchange event for the description slot.
1410
- * Updates ariaDescribedByElements on the spinbutton.
1411
- *
1412
- * @param {Event} event - The slotchange event.
1413
- * @private
1414
- */
1415
- onDescriptionSlotChange(event) {
1416
- const spinbutton = this.shadowRoot.querySelector('[role="spinbutton"]');
1417
- if (spinbutton) {
1418
- const assigned = event.target.assignedElements();
1419
- spinbutton.ariaDescribedByElements = assigned.length > 0 ? assigned : [];
1420
- }
1421
- }
1422
-
1423
1408
  updated(changedProperties) {
1424
1409
  if (changedProperties.has("value")) {
1425
1410
  this.validate();
@@ -1475,7 +1460,7 @@ class AuroCounter extends LitElement {
1475
1460
  <label class="label">
1476
1461
  <slot @slotchange="${this.onDefaultSlotChange}"></slot>
1477
1462
  </label>
1478
- <slot name="description" class="body-xs" @slotchange="${this.onDescriptionSlotChange}"></slot>
1463
+ <slot name="description" class="body-xs"></slot>
1479
1464
  </div>
1480
1465
  <div
1481
1466
  part="counterControl"
@@ -3776,12 +3761,40 @@ class AuroFloatingUI {
3776
3761
  return;
3777
3762
  }
3778
3763
 
3764
+ // Chrome-specific: during popover top-layer promotion after a click on a
3765
+ // slotted focusable, :focus-within can briefly evaluate false while the
3766
+ // active element is still structurally inside the trigger/bib. Fall back
3767
+ // to a shadow-piercing ancestry walk from the deep active element before
3768
+ // treating this as a real focus loss.
3769
+ try {
3770
+ let active = document.activeElement;
3771
+ while (active && active.shadowRoot && active.shadowRoot.activeElement) {
3772
+ active = active.shadowRoot.activeElement;
3773
+ }
3774
+ const targets = [element, element.trigger, element.bib].filter(Boolean);
3775
+ let node = active;
3776
+ while (node) {
3777
+ if (targets.includes(node)) {
3778
+ return;
3779
+ }
3780
+ node =
3781
+ node.parentElement ||
3782
+ (node.getRootNode && node.getRootNode().host) ||
3783
+ null;
3784
+ }
3785
+ } catch (e) {
3786
+ // Defensive: fall through to the existing close path if traversal fails.
3787
+ }
3788
+
3779
3789
  // if fullscreen bib is in fullscreen mode, do not close
3780
3790
  if (element.bib.hasAttribute("isfullscreen")) {
3781
3791
  return;
3782
3792
  }
3783
3793
 
3784
- this.hideBib("keydown");
3794
+ // eventType "focusloss" distinguishes a Tab/click-driven close from an
3795
+ // Escape keydown close. Consumers use this to decide whether to restore
3796
+ // focus to the trigger (Escape) or let it advance naturally (Tab).
3797
+ this.hideBib("focusloss");
3785
3798
  }
3786
3799
 
3787
3800
  setupHideHandlers() {
@@ -4451,199 +4464,6 @@ function getFocusableElements(container) {
4451
4464
  return tabIndexedUniqueElements;
4452
4465
  }
4453
4466
 
4454
- /**
4455
- * FocusTrap manages keyboard focus within a specified container element, ensuring that focus does not leave the container when tabbing.
4456
- * It is commonly used for modal dialogs or overlays to improve accessibility by trapping focus within interactive UI components.
4457
- */
4458
- class FocusTrap {
4459
- /**
4460
- * Creates a new FocusTrap instance for the given container element.
4461
- * Initializes event listeners and prepares the container for focus management.
4462
- *
4463
- * @param {HTMLElement} container The DOM element to trap focus within.
4464
- * @param {boolean} [controlTabOrder=false] If true enables manual control of the tab order by the FocusTrap.
4465
- * @throws {Error} If the provided container is not a valid HTMLElement.
4466
- */
4467
- constructor(container, controlTabOrder = false) {
4468
- if (!container || !(container instanceof HTMLElement)) {
4469
- throw new Error("FocusTrap requires a valid HTMLElement.");
4470
- }
4471
-
4472
- this.container = container;
4473
- this.tabDirection = "forward"; // or 'backward';
4474
- this.controlTabOrder = controlTabOrder;
4475
-
4476
- this._init();
4477
- }
4478
-
4479
- /**
4480
- * Initializes the focus trap by setting up event listeners and attributes on the container.
4481
- * Prepares the container for focus management, including support for shadow DOM and inert attributes.
4482
- *
4483
- * @private
4484
- */
4485
- _init() {
4486
- // Add inert attribute to prevent focusing programmatically as well (if supported)
4487
- if ("inert" in HTMLElement.prototype) {
4488
- this.container.inert = false; // Ensure the container isn't inert
4489
- this.container.setAttribute("data-focus-trap-container", true); // Mark for identification
4490
- }
4491
-
4492
- // Track tab direction
4493
- this.container.addEventListener("keydown", this._onKeydown);
4494
- }
4495
-
4496
- /**
4497
- * Gets an array of currently active (focused) elements in the document and shadow DOM.
4498
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
4499
- * @private
4500
- */
4501
- _getActiveElements() {
4502
- // Get the active element(s) in the document and shadow root
4503
- // This will include the active element in the shadow DOM if it exists
4504
- // Active element may be inside the shadow DOM depending on delegatesFocus, so we need to check both
4505
- let { activeElement } = document;
4506
- const actives = [activeElement];
4507
- while (activeElement?.shadowRoot?.activeElement) {
4508
- actives.push(activeElement.shadowRoot.activeElement);
4509
- activeElement = activeElement.shadowRoot.activeElement;
4510
- }
4511
- return actives;
4512
- }
4513
-
4514
- /**
4515
- * Gets the next focus index based on the current index and focusable elements.
4516
- * @param {number} currentIndex The current index of the focused element.
4517
- * @param {Array<HTMLElement>} focusables The array of focusable elements.
4518
- * @returns {number|null} The next focus index or null if not determined.
4519
- */
4520
- _getNextFocusIndex(currentIndex, focusables, actives) {
4521
- if (this.controlTabOrder) {
4522
- // Calculate the new index based on the current index and tab direction
4523
- let newFocusIndex =
4524
- currentIndex + (this.tabDirection === "forward" ? 1 : -1);
4525
-
4526
- // Wrap-around logic
4527
- if (newFocusIndex < 0) newFocusIndex = focusables.length - 1;
4528
- if (newFocusIndex >= focusables.length) newFocusIndex = 0;
4529
-
4530
- // Early return with the new index
4531
- return newFocusIndex;
4532
- }
4533
-
4534
- // Determine if we need to wrap
4535
- const atFirst =
4536
- actives.includes(focusables[0]) || actives.includes(this.container);
4537
- const atLast = actives.includes(focusables[focusables.length - 1]);
4538
-
4539
- // Only wrap if at the ends
4540
- if (this.tabDirection === "backward" && atFirst) {
4541
- return focusables.length - 1;
4542
- }
4543
-
4544
- if (this.tabDirection === "forward" && atLast) {
4545
- return 0;
4546
- }
4547
-
4548
- // No wrap, so don't change focus, return early
4549
- return null;
4550
- }
4551
-
4552
- /**
4553
- * Handles the Tab key press event to manage focus within the container.
4554
- * @param {KeyboardEvent} e The keyboard event triggered by the user.
4555
- * @returns {void}
4556
- */
4557
- _handleTabKey(e) {
4558
- // Update the focusable elements
4559
- const focusables = this._getFocusableElements();
4560
-
4561
- // If there are no focusable elements, exit
4562
- if (!focusables.length) return;
4563
-
4564
- // Set the tab direction based on the key pressed
4565
- this.tabDirection = e.shiftKey ? "backward" : "forward";
4566
-
4567
- // Get the active elements that are currently focused
4568
- const actives = this._getActiveElements();
4569
-
4570
- // If we're at either end of the focusable elements, wrap around to the other end
4571
- let focusIndex = focusables.findIndex((el) => actives.includes(el));
4572
-
4573
- // Fallback if we have no focused element
4574
- if (focusIndex === -1) focusIndex = 0;
4575
-
4576
- // Get the next focus index based on the current focus index, tab direction, and controlTabOrder setting
4577
- // Is null if no new focus index is determined
4578
- const newFocusIndex = this._getNextFocusIndex(
4579
- focusIndex,
4580
- focusables,
4581
- actives,
4582
- );
4583
-
4584
- // If we have a new focus index, set focus to that element
4585
- if (newFocusIndex !== null) {
4586
- e.preventDefault();
4587
- focusables[newFocusIndex].focus();
4588
- }
4589
- }
4590
-
4591
- /**
4592
- * Catches the keydown event
4593
- * @param {KeyboardEvent} e The keyboard event triggered by user interaction.
4594
- * @private
4595
- */
4596
- _onKeydown = (e) => {
4597
- // Handle tab
4598
- if (e.key === "Tab") this._handleTabKey(e);
4599
- };
4600
-
4601
- /**
4602
- * Retrieves all focusable elements within the container in DOM order, including those in shadow DOM and slots.
4603
- * Returns a unique, ordered array of elements that can receive focus.
4604
- *
4605
- * @returns {Array<HTMLElement>} An array of focusable elements within the container.
4606
- * @private
4607
- */
4608
- _getFocusableElements() {
4609
- // Use the imported utility function to get focusable elements
4610
- const elements = getFocusableElements(this.container);
4611
-
4612
- // Return the elements found
4613
- return elements;
4614
- }
4615
-
4616
- /**
4617
- * Moves focus to the first focusable element within the container.
4618
- * Useful for setting initial focus when activating the focus trap.
4619
- */
4620
- focusFirstElement() {
4621
- const focusables = this._getFocusableElements();
4622
- if (focusables.length) focusables[0].focus();
4623
- }
4624
-
4625
- /**
4626
- * Moves focus to the last focusable element within the container.
4627
- * Useful for setting focus when deactivating or cycling focus in reverse.
4628
- */
4629
- focusLastElement() {
4630
- const focusables = this._getFocusableElements();
4631
- if (focusables.length) focusables[focusables.length - 1].focus();
4632
- }
4633
-
4634
- /**
4635
- * Removes event listeners and attributes added by the focus trap.
4636
- * Call this method to clean up when the focus trap is no longer needed.
4637
- */
4638
- disconnect() {
4639
- if (this.container.hasAttribute("data-focus-trap-container")) {
4640
- this.container.removeAttribute("data-focus-trap-container");
4641
- }
4642
-
4643
- this.container.removeEventListener("keydown", this._onKeydown);
4644
- }
4645
- }
4646
-
4647
4467
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
4648
4468
  // See LICENSE in the project root for license information.
4649
4469
 
@@ -5141,7 +4961,7 @@ class AuroDropdownBib extends LitElement {
5141
4961
  classes[`shape-${this.shape}`] = true;
5142
4962
 
5143
4963
  return html`
5144
- <dialog class="${classMap(classes)}" part="bibContainer" role="${ifDefined(this.dialogRole)}" aria-labelledby="${ifDefined(this.dialogLabel ? 'dialogLabel' : undefined)}">
4964
+ <dialog tabindex="-1" class="${classMap(classes)}" part="bibContainer" role="${ifDefined(this.dialogRole)}" aria-labelledby="${ifDefined(this.dialogLabel ? 'dialogLabel' : undefined)}">
5145
4965
  ${this.dialogLabel ? html`<span id="dialogLabel" class="util_displayHiddenVisually">${this.dialogLabel}</span>` : ''}
5146
4966
  <slot></slot>
5147
4967
  <span id="srAnnouncement" class="util_displayHiddenVisually" aria-live="polite" role="status"></span>
@@ -5392,7 +5212,7 @@ class AuroHelpText extends LitElement {
5392
5212
  }
5393
5213
  }
5394
5214
 
5395
- var formkitVersion = '202607092329';
5215
+ var formkitVersion = '202607102138';
5396
5216
 
5397
5217
  let AuroElement$1 = class AuroElement extends LitElement {
5398
5218
  static get properties() {
@@ -6146,7 +5966,10 @@ class AuroDropdown extends AuroElement$1 {
6146
5966
  }
6147
5967
 
6148
5968
 
6149
- if (!this.isPopoverVisible) {
5969
+ // On Tab-driven close (eventType "focusloss"), let focus advance naturally
5970
+ // — restoring to the trigger would trap the user on this dropdown, forcing
5971
+ // an extra Tab to move on. Escape and outside-click still restore.
5972
+ if (!this.isPopoverVisible && eventType !== "focusloss") {
6150
5973
  // wait til the bib gets fully closed and rendered
6151
5974
  setTimeout(() => {
6152
5975
  // Skip if the bib re-opened, or if focus moved intentionally outside the dropdown (not to body).
@@ -6376,15 +6199,16 @@ class AuroDropdown extends AuroElement$1 {
6376
6199
  }
6377
6200
  });
6378
6201
  } else {
6379
- // Normal desktop: use FocusTrap on the bib element.
6380
- // Defer focusFirstElement to the next frame because the popover
6381
- // is positioned asynchronously by Floating UI — calling focus()
6382
- // synchronously here would target elements with zero dimensions
6383
- // and the focus call would be silently ignored.
6384
- this.focusTrap = new FocusTrap(this.bibContent);
6202
+ // Normal desktop (non-modal): move initial focus into the bib but
6203
+ // don't trap Tab. Tab should exit the bib and let the floater's
6204
+ // handleFocusLoss close it, matching native <select>/<details>
6205
+ // behavior. Deferred one frame because Floating UI positions the
6206
+ // popover asynchronously a synchronous focus() would target
6207
+ // zero-dimension elements and be silently ignored.
6385
6208
  requestAnimationFrame(() => {
6386
- if (this.focusTrap) {
6387
- this.focusTrap.focusFirstElement();
6209
+ const focusables = getFocusableElements(this.bibContent);
6210
+ if (focusables.length) {
6211
+ focusables[0].focus();
6388
6212
  }
6389
6213
  });
6390
6214
  }
@@ -7982,6 +7806,19 @@ class AuroCounterGroup extends AuroElement {
7982
7806
 
7983
7807
  if (this.isDropdown) {
7984
7808
  applyKeyboardStrategy$1(this, counterGroupKeyboardStrategy);
7809
+
7810
+ // noHideOnThisFocusLoss=true on the dropdown prevents handleFocusLoss from
7811
+ // closing the bib when focus moves out via Tab. Close explicitly via focusout:
7812
+ // if relatedTarget is outside the counter-group's light DOM, focus has left.
7813
+ this.addEventListener('focusout', (event) => {
7814
+ if (!this.dropdown?.isPopoverVisible || this.dropdown?.isBibFullscreen) {
7815
+ return;
7816
+ }
7817
+ if (event.relatedTarget && this.contains(event.relatedTarget)) {
7818
+ return;
7819
+ }
7820
+ this.hideBib();
7821
+ });
7985
7822
  }
7986
7823
  }
7987
7824