@primer/view-components 0.2.0-rc.e70004c0 → 0.2.0-rc.e85603cb

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.
@@ -116,6 +116,19 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
116
116
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get).focus();
117
117
  }
118
118
  else if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivationKeydown).call(this, event) || (event instanceof MouseEvent && event.type === 'click')) {
119
+ // Hide popover after current event loop to prevent changes in focus from
120
+ // altering the target of the event. Not doing this specifically affects
121
+ // <a> tags. It causes the event to be sent to the currently focused element
122
+ // instead of the anchor, which effectively prevents navigation, i.e. it
123
+ // appears as if hitting enter does nothing. Curiously, clicking instead
124
+ // works fine.
125
+ if (this.selectVariant !== 'multiple') {
126
+ setTimeout(() => { var _a; return (_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.hidePopover(); });
127
+ }
128
+ // The rest of the code below deals with single/multiple selection behavior, and should not
129
+ // interfere with events fired by menu items whose behavior is specified outside the library.
130
+ if (this.selectVariant !== 'multiple' && this.selectVariant !== 'single')
131
+ return;
119
132
  const item = event.target.closest(menuItemSelectors.join(','));
120
133
  if (!item)
121
134
  return;
@@ -135,15 +148,6 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
135
148
  // prevent buttons from being clicked twice
136
149
  event.preventDefault();
137
150
  }
138
- // Hide popover after current event loop to prevent changes in focus from
139
- // altering the target of the event. Not doing this specifically affects
140
- // <a> tags. It causes the event to be sent to the currently focused element
141
- // instead of the anchor, which effectively prevents navigation, i.e. it
142
- // appears as if hitting enter does nothing. Curiously, clicking instead
143
- // works fine.
144
- if (this.selectVariant !== 'multiple') {
145
- setTimeout(() => { var _a; return (_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.hidePopover(); });
146
- }
147
151
  }
148
152
  }
149
153
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.2.0-rc.e70004c0",
3
+ "version": "0.2.0-rc.e85603cb",
4
4
  "description": "ViewComponents for the Primer Design System",
5
5
  "main": "app/assets/javascripts/primer_view_components.js",
6
6
  "module": "app/components/primer/primer.js",