@aurodesignsystem/auro-library 5.13.0 → 5.13.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Semantic Release Automated Changelog
2
2
 
3
+ ## [5.13.2](https://github.com/AlaskaAirlines/auro-library/compare/v5.13.1...v5.13.2) (2026-07-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * track visualViewport continuously during scroll lock ([631cf89](https://github.com/AlaskaAirlines/auro-library/commit/631cf89627fd4053b0ae8252736eb1db78919843))
9
+
10
+ ## [5.13.1](https://github.com/AlaskaAirlines/auro-library/compare/v5.13.0...v5.13.1) (2026-07-10)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **floatingUI:** handle focus loss in Chrome during popover promotion ([511b2a0](https://github.com/AlaskaAirlines/auro-library/commit/511b2a04ffb28b421d183f1a192fea59e7082c4c))
16
+ * **floatingUI:** update hideBib method to differentiate focus loss events ([632366f](https://github.com/AlaskaAirlines/auro-library/commit/632366f24b2aa66455c9024f0538a588e7e8f9d1))
17
+
3
18
  # [5.13.0](https://github.com/AlaskaAirlines/auro-library/compare/v5.12.3...v5.13.0) (2026-05-14)
4
19
 
5
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem/auro-library",
3
- "version": "5.13.0",
3
+ "version": "5.13.2",
4
4
  "description": "This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -339,15 +339,57 @@ export default class AuroFloatingUI {
339
339
  document.body.style.top = `-${this._savedScrollY}px`;
340
340
  document.body.style.width = "100%";
341
341
 
342
- // Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
343
- if (element?.bib && window?.visualViewport?.offsetTop) {
344
- element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
342
+ // Keep the bib aligned with the visual viewport as the VKB opens.
343
+ // A one-shot offsetTop check at lock time is stale by the time the user
344
+ // taps an input mid-drawer — iOS then pans visualViewport upward and the
345
+ // bib drifts off-screen. Listen continuously so the transform tracks the pan.
346
+ // RAF-throttled to avoid a style recalc on every scroll tick during the
347
+ // keyboard animation; the pending frame is canceled on unlock so it cannot
348
+ // reapply a translate after bibTransform has been restored.
349
+ if (window.visualViewport) {
350
+ this._viewportRafId = undefined;
351
+ this._viewportHandler = () => {
352
+ if (this._viewportRafId !== undefined) {
353
+ return;
354
+ }
355
+ this._viewportRafId = requestAnimationFrame(() => {
356
+ this._viewportRafId = undefined;
357
+ if (element?.bib) {
358
+ element.bib.style.transform = `translateY(${window.visualViewport.offsetTop}px)`;
359
+ }
360
+ });
361
+ };
362
+ window.visualViewport.addEventListener(
363
+ "resize",
364
+ this._viewportHandler,
365
+ );
366
+ window.visualViewport.addEventListener(
367
+ "scroll",
368
+ this._viewportHandler,
369
+ );
370
+ this._viewportHandler();
345
371
  }
346
372
 
347
373
  this.lockTouchScroll(true);
348
374
  }
349
375
  } else {
350
376
  if (this._scrollLocked) {
377
+ if (this._viewportHandler && window.visualViewport) {
378
+ window.visualViewport.removeEventListener(
379
+ "resize",
380
+ this._viewportHandler,
381
+ );
382
+ window.visualViewport.removeEventListener(
383
+ "scroll",
384
+ this._viewportHandler,
385
+ );
386
+ this._viewportHandler = undefined;
387
+ }
388
+ if (this._viewportRafId !== undefined) {
389
+ cancelAnimationFrame(this._viewportRafId);
390
+ this._viewportRafId = undefined;
391
+ }
392
+
351
393
  document.documentElement.style.scrollbarGutter =
352
394
  this._savedScrollStyles?.rootScrollbarGutter ?? "";
353
395
  document.documentElement.style.overflow =
@@ -439,7 +481,7 @@ export default class AuroFloatingUI {
439
481
  bibContent.style.width = "";
440
482
  bibContent.style.height = "";
441
483
  bibContent.style.maxWidth = "";
442
- bibContent.style.maxHeight = `${window?.visualViewport?.height}px`;
484
+ bibContent.style.maxHeight = "";
443
485
  this.configureTrial = 0;
444
486
  } else if (this.configureTrial < MAX_CONFIGURATION_COUNT) {
445
487
  this.configureTrial += 1;
@@ -526,12 +568,40 @@ export default class AuroFloatingUI {
526
568
  return;
527
569
  }
528
570
 
571
+ // Chrome-specific: during popover top-layer promotion after a click on a
572
+ // slotted focusable, :focus-within can briefly evaluate false while the
573
+ // active element is still structurally inside the trigger/bib. Fall back
574
+ // to a shadow-piercing ancestry walk from the deep active element before
575
+ // treating this as a real focus loss.
576
+ try {
577
+ let active = document.activeElement;
578
+ while (active && active.shadowRoot && active.shadowRoot.activeElement) {
579
+ active = active.shadowRoot.activeElement;
580
+ }
581
+ const targets = [element, element.trigger, element.bib].filter(Boolean);
582
+ let node = active;
583
+ while (node) {
584
+ if (targets.includes(node)) {
585
+ return;
586
+ }
587
+ node =
588
+ node.parentElement ||
589
+ (node.getRootNode && node.getRootNode().host) ||
590
+ null;
591
+ }
592
+ } catch (e) {
593
+ // Defensive: fall through to the existing close path if traversal fails.
594
+ }
595
+
529
596
  // if fullscreen bib is in fullscreen mode, do not close
530
597
  if (element.bib.hasAttribute("isfullscreen")) {
531
598
  return;
532
599
  }
533
600
 
534
- this.hideBib("keydown");
601
+ // eventType "focusloss" distinguishes a Tab/click-driven close from an
602
+ // Escape keydown close. Consumers use this to decide whether to restore
603
+ // focus to the trigger (Escape) or let it advance naturally (Tab).
604
+ this.hideBib("focusloss");
535
605
  }
536
606
 
537
607
  setupHideHandlers() {
@@ -86,7 +86,7 @@ describe("AuroFloatingUI", () => {
86
86
  expect(hideBibSpy.called).to.be.false;
87
87
  });
88
88
 
89
- it("hides with a keydown event when the host no longer has focus", () => {
89
+ it("hides with a focus loss event when the host no longer has focus", () => {
90
90
  const checkedSelectors = [];
91
91
 
92
92
  sinon.stub(host, "matches").callsFake((selector) => {
@@ -97,7 +97,7 @@ describe("AuroFloatingUI", () => {
97
97
  floatingUI.handleFocusLoss();
98
98
 
99
99
  expect(checkedSelectors).to.deep.equal([":focus", ":focus-within"]);
100
- expect(hideBibSpy.calledOnceWithExactly("keydown")).to.be.true;
100
+ expect(hideBibSpy.calledOnceWithExactly("focusloss")).to.be.true;
101
101
  });
102
102
 
103
103
  it("no-ops safely when element is not set", () => {