@aurodesignsystem/auro-library 4.1.0-beta.3 → 4.1.0-beta.4

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,14 @@
1
1
  # Semantic Release Automated Changelog
2
2
 
3
+ # [4.1.0-beta.4](https://github.com/AlaskaAirlines/auro-library/compare/v4.1.0-beta.3...v4.1.0-beta.4) (2025-04-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add SSR env condition check in floatingUI ([c71a77e](https://github.com/AlaskaAirlines/auro-library/commit/c71a77ed805dc2e61593dd0c483a01c9f19e2a01))
9
+ * not to hide bib on blur event with mouse being pressed ([8808ee6](https://github.com/AlaskaAirlines/auro-library/commit/8808ee6911ccfb81c0e9a0ed23762852983e1239))
10
+ * setup mousePressChecker in floatingUI's configure function ([6136d36](https://github.com/AlaskaAirlines/auro-library/commit/6136d36a980802dc56a0bea9d9aa12b7bf3e6621))
11
+
3
12
  # [4.1.0-beta.3](https://github.com/AlaskaAirlines/auro-library/compare/v4.1.0-beta.2...v4.1.0-beta.3) (2025-04-09)
4
13
 
5
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem/auro-library",
3
- "version": "4.1.0-beta.3",
3
+ "version": "4.1.0-beta.4",
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",
@@ -6,6 +6,23 @@ import { autoUpdate, computePosition, offset, autoPlacement, flip } from '@float
6
6
  const MAX_CONFIGURATION_COUNT = 10;
7
7
 
8
8
  export default class AuroFloatingUI {
9
+
10
+ static isMousePressed = false;
11
+
12
+ static issetupMousePressChecker = false;
13
+
14
+ static setupMousePressChecker() {
15
+ if (!AuroFloatingUI.issetupMousePressChecker && window && window.addEventListener) {
16
+ AuroFloatingUI.issetupMousePressChecker = true;
17
+ function mouseEventGlobalHandler(event) {
18
+ AuroFloatingUI.isMousePressed = event.type === 'mousedown';
19
+ }
20
+
21
+ window.addEventListener('mousedown', mouseEventGlobalHandler);
22
+ window.addEventListener('mouseup', mouseEventGlobalHandler);
23
+ }
24
+ }
25
+
9
26
  constructor(element, behavior) {
10
27
  this.element = element;
11
28
  this.behavior = behavior;
@@ -197,7 +214,7 @@ export default class AuroFloatingUI {
197
214
 
198
215
  setTimeout(() => {
199
216
  this.configureBibStrategy(value);
200
- });
217
+ }, 0);
201
218
  }
202
219
 
203
220
  if (this.element.isPopoverVisible) {
@@ -244,6 +261,11 @@ export default class AuroFloatingUI {
244
261
  * If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
245
262
  */
246
263
  handleFocusLoss() {
264
+ // if moused is being pressed, skip and let click event to handle the action
265
+ if (AuroFloatingUI.isMousePressed) {
266
+ return;
267
+ }
268
+
247
269
  if (this.element.noHideOnThisFocusLoss ||
248
270
  this.element.hasAttribute('noHideOnThisFocusLoss')) {
249
271
  return;
@@ -312,7 +334,7 @@ export default class AuroFloatingUI {
312
334
  // it conflicts if showBib gets call from a button that's not this.element.trigger
313
335
  setTimeout(() => {
314
336
  window.addEventListener('click', this.clickHandler);
315
- });
337
+ }, 0);
316
338
  }
317
339
 
318
340
  cleanupHideHandlers() {
@@ -461,8 +483,9 @@ export default class AuroFloatingUI {
461
483
  }
462
484
  break;
463
485
  case 'blur':
464
- // send this task to end of the queue to wait a frame in case focus moves within the floating element/bib
465
- setTimeout(() => this.handleFocusLoss());
486
+ // send this task 100ms later queue to
487
+ // wait a frame in case focus moves within the floating element/bib
488
+ setTimeout(() => this.handleFocusLoss(), 0);
466
489
  break;
467
490
  case 'click':
468
491
  if (document.activeElement === document.body) {
@@ -530,6 +553,8 @@ export default class AuroFloatingUI {
530
553
  }
531
554
 
532
555
  configure(elem, eventPrefix) {
556
+ AuroFloatingUI.setupMousePressChecker();
557
+
533
558
  this.eventPrefix = eventPrefix;
534
559
  if (this.element !== elem) {
535
560
  this.element = elem;
@@ -570,20 +595,22 @@ export default class AuroFloatingUI {
570
595
 
571
596
  disconnect() {
572
597
  this.cleanupHideHandlers();
573
- this.element.cleanup?.();
598
+ if (this.element) {
599
+ this.element.cleanup?.();
574
600
 
575
- if (this.element.bib) {
576
- this.element.shadowRoot.append(this.element.bib);
577
- }
578
-
579
- // Remove event & keyboard listeners
580
- if (this.element?.trigger) {
581
- this.element.trigger.removeEventListener('keydown', this.handleEvent);
582
- this.element.trigger.removeEventListener('click', this.handleEvent);
583
- this.element.trigger.removeEventListener('mouseenter', this.handleEvent);
584
- this.element.trigger.removeEventListener('mouseleave', this.handleEvent);
585
- this.element.trigger.removeEventListener('focus', this.handleEvent);
586
- this.element.trigger.removeEventListener('blur', this.handleEvent);
601
+ if (this.element.bib) {
602
+ this.element.shadowRoot.append(this.element.bib);
603
+ }
604
+
605
+ // Remove event & keyboard listeners
606
+ if (this.element?.trigger) {
607
+ this.element.trigger.removeEventListener('keydown', this.handleEvent);
608
+ this.element.trigger.removeEventListener('click', this.handleEvent);
609
+ this.element.trigger.removeEventListener('mouseenter', this.handleEvent);
610
+ this.element.trigger.removeEventListener('mouseleave', this.handleEvent);
611
+ this.element.trigger.removeEventListener('focus', this.handleEvent);
612
+ this.element.trigger.removeEventListener('blur', this.handleEvent);
613
+ }
587
614
  }
588
615
  }
589
616
  }