@fusion.dev/helix-headless 0.215.1 → 0.215.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.
@@ -99,7 +99,7 @@ export declare class HelixHeadlessIcon extends HelixElement {
99
99
  *
100
100
  * **A lookup, and the reason both this and `icon` exist.** A name is a string,
101
101
  * so it is what markup can carry, and resolving one means an index of the
102
- * whole set that no bundler can shake: 15 kB for a consumer who renders one
102
+ * whole set that no bundler can shake: 17 kB for a consumer who renders one
103
103
  * mark. An attribute is the only thing an HTML author can write, and that is
104
104
  * worth the index; a consumer who would rather not pay it imports the
105
105
  * element from `icon/root` and registers the glyphs it names, or hands over
@@ -368,10 +368,19 @@ export declare class HelixHeadlessMap extends HelixHeadlessMap_base {
368
368
  private hiding?;
369
369
  /** Closes the layers menu on a press anywhere outside the frame. */
370
370
  private readonly handleOutside;
371
+ private pressingMenu;
372
+ /**
373
+ * Notes a press inside the menu. A map type's picture and name take no focus,
374
+ * so the browser moves focus to the nearest focusable ancestor, the region,
375
+ * on `pointerdown`. That is not the focus moving on, and closing the menu for
376
+ * it hides the type before the release can click it.
377
+ */
378
+ private readonly handleMenuPress;
371
379
  /**
372
380
  * Closes the layers menu when focus moves on from its button and the menu,
373
381
  * as a Tab past the last tile does. Focus leaving the page, with nothing
374
- * focused in its place, leaves the menu as it is.
382
+ * focused in its place, leaves the menu as it is, and so does focus moved by
383
+ * a press inside the menu.
375
384
  */
376
385
  private readonly handleMenuFocusOut;
377
386
  /**
@@ -79,9 +79,20 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
79
79
  this.layersOpen = false;
80
80
  }
81
81
  };
82
+ this.pressingMenu = false;
83
+ this.handleMenuPress = () => {
84
+ this.pressingMenu = true;
85
+ const release = () => {
86
+ this.pressingMenu = false;
87
+ window.removeEventListener('pointerup', release, true);
88
+ window.removeEventListener('pointercancel', release, true);
89
+ };
90
+ window.addEventListener('pointerup', release, true);
91
+ window.addEventListener('pointercancel', release, true);
92
+ };
82
93
  this.handleMenuFocusOut = (event) => {
83
94
  const to = event.relatedTarget;
84
- if (!(this.layersOpen && to)) {
95
+ if (!(this.layersOpen && to) || this.pressingMenu) {
85
96
  return;
86
97
  }
87
98
  const owners = this.renderRoot.querySelectorAll('[part="layers-toggle"], [part="layers-menu"]');
@@ -433,6 +444,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
433
444
  aria-label=${this.layersLabel}
434
445
  ?hidden=${!this.layersOpen}
435
446
  @focusout=${this.handleMenuFocusOut}
447
+ @pointerdown=${this.handleMenuPress}
436
448
  @keydown=${this.handleMenuKeydown}
437
449
  >
438
450
  ${this.imagery.length > 0 ? this.renderMapTypes() : nothing}