@momentum-design/components 0.102.9 → 0.103.0

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.
@@ -220,7 +220,7 @@ declare class Dialog extends Dialog_base {
220
220
  */
221
221
  private isOpenUpdated;
222
222
  /**
223
- * Sets the focs back to the trigger element or the last active element.
223
+ * Sets the focus back to the trigger element or the last active element.
224
224
  * This is called when the dialog is closed to ensure that the user can continue interacting with the application.
225
225
  *
226
226
  * @internal
@@ -376,7 +376,7 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
376
376
  }
377
377
  }
378
378
  /**
379
- * Sets the focs back to the trigger element or the last active element.
379
+ * Sets the focus back to the trigger element or the last active element.
380
380
  * This is called when the dialog is closed to ensure that the user can continue interacting with the application.
381
381
  *
382
382
  * @internal
@@ -341,6 +341,11 @@ declare class Popover extends Popover_base {
341
341
  * If the popover is hovered, it will not hide the popover.
342
342
  */
343
343
  private handleFocusOut;
344
+ /**
345
+ * Handles focus in event on the trigger element.
346
+ * This method checks if the trigger element has visible focus or is being hovered.
347
+ */
348
+ private handleFocusIn;
344
349
  /**
345
350
  * Starts the close delay timer.
346
351
  * If the popover is not interactive, it will close the popover after the delay.
@@ -330,7 +330,7 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
330
330
  this.addEventListener('mouseleave', this.startCloseDelay);
331
331
  }
332
332
  if (this.trigger.includes('focusin')) {
333
- this.triggerElement.addEventListener('focusin', this.show);
333
+ this.triggerElement.addEventListener('focusin', this.handleFocusIn);
334
334
  if (!this.interactive) {
335
335
  this.triggerElement.addEventListener('focusout', this.handleFocusOut);
336
336
  }
@@ -351,7 +351,7 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
351
351
  this.removeEventListener('mouseenter', this.cancelCloseDelay);
352
352
  this.removeEventListener('mouseleave', this.startCloseDelay);
353
353
  // focusin trigger
354
- (_d = this.triggerElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('focusin', this.show);
354
+ (_d = this.triggerElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('focusin', this.handleFocusIn);
355
355
  (_e = this.triggerElement) === null || _e === void 0 ? void 0 : _e.removeEventListener('focusout', this.handleFocusOut);
356
356
  };
357
357
  /**
@@ -443,6 +443,16 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
443
443
  this.hide();
444
444
  }
445
445
  };
446
+ /**
447
+ * Handles focus in event on the trigger element.
448
+ * This method checks if the trigger element has visible focus or is being hovered.
449
+ */
450
+ this.handleFocusIn = () => {
451
+ var _a;
452
+ if (((_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.matches(':focus-visible')) || this.isHovered) {
453
+ this.show();
454
+ }
455
+ };
446
456
  /**
447
457
  * Starts the close delay timer.
448
458
  * If the popover is not interactive, it will close the popover after the delay.