@primer/view-components 0.1.9-rc.ed6f20bc → 0.1.10-rc.fdc6a7e6

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.
@@ -11,15 +11,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _ActionMenuElement_instances, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_isEnterKeydown, _ActionMenuElement_firstItem_get;
13
13
  import '@github/include-fragment-element';
14
- const popoverSelector = (() => {
15
- try {
16
- document.querySelector(':open');
17
- return ':open';
18
- }
19
- catch (_a) {
20
- return '.\\:open';
21
- }
22
- })();
23
14
  const menuItemSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]'];
24
15
  export class ActionMenuElement extends HTMLElement {
25
16
  constructor() {
@@ -109,7 +100,7 @@ export class ActionMenuElement extends HTMLElement {
109
100
  return;
110
101
  }
111
102
  }
112
- if (!((_b = this.popoverElement) === null || _b === void 0 ? void 0 : _b.matches(popoverSelector)))
103
+ if (!((_b = this.popoverElement) === null || _b === void 0 ? void 0 : _b.matches(':popover-open')))
113
104
  return;
114
105
  if (event.type === 'focusout' && !this.contains(event.relatedTarget)) {
115
106
  (_c = this.popoverElement) === null || _c === void 0 ? void 0 : _c.hidePopover();
@@ -31,6 +31,10 @@ function clickHandler(event) {
31
31
  if (dialog instanceof ModalDialogElement) {
32
32
  dialog.openButton = button;
33
33
  dialog.show();
34
+ // A buttons default behaviour in some browsers it to send a pointer event
35
+ // If the behaviour is allowed through the dialog will be shown but then
36
+ // quickly hidden- as if it were never shown. This prevents that.
37
+ event.preventDefault();
34
38
  return;
35
39
  }
36
40
  }
@@ -12,15 +12,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _FocusGroupElement_instances, _FocusGroupElement_abortController, _FocusGroupElement_items_get;
13
13
  import '@oddbird/popover-polyfill';
14
14
  const menuItemSelector = '[role="menuitem"],[role="menuitemcheckbox"],[role="menuitemradio"]';
15
- const popoverSelector = (() => {
16
- try {
17
- document.querySelector(':open');
18
- return ':open';
19
- }
20
- catch (_a) {
21
- return '.\\:open';
22
- }
23
- })();
24
15
  const getMnemonicFor = (item) => { var _a; return (_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()[0].toLowerCase(); };
25
16
  const printable = /^\S$/;
26
17
  export default class FocusGroupElement extends HTMLElement {
@@ -128,13 +119,11 @@ export default class FocusGroupElement extends HTMLElement {
128
119
  {
129
120
  let el = focusEl;
130
121
  do {
131
- el = el.closest(`[popover]:not(${popoverSelector})`);
122
+ el = el.closest(`[popover]:not(:popover-open)`);
132
123
  if ((el === null || el === void 0 ? void 0 : el.popover) === 'auto') {
133
124
  el.showPopover();
134
125
  }
135
- else {
136
- el = (el === null || el === void 0 ? void 0 : el.parentElement) || null;
137
- }
126
+ el = (el === null || el === void 0 ? void 0 : el.parentElement) || null;
138
127
  } while (el);
139
128
  }
140
129
  focusEl === null || focusEl === void 0 ? void 0 : focusEl.focus();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.1.9-rc.ed6f20bc",
3
+ "version": "0.1.10-rc.fdc6a7e6",
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",
@@ -54,8 +54,8 @@
54
54
  "@github/mini-throttle": "^2.1.0",
55
55
  "@github/relative-time-element": "^4.0.0",
56
56
  "@github/tab-container-element": "^3.1.2",
57
- "@oddbird/popover-polyfill": "^0.1.1",
58
- "@primer/behaviors": "^1.2.0"
57
+ "@oddbird/popover-polyfill": "^0.2.0",
58
+ "@primer/behaviors": "^1.3.4"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@changesets/changelog-github": "^0.4.6",