@primer/view-components 0.1.9-rc.4a184d98 → 0.1.9-rc.7afa7f19

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.
@@ -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
  }
@@ -96,6 +100,7 @@ export class ModalDialogElement extends HTMLElement {
96
100
  if (this.open)
97
101
  return;
98
102
  this.setAttribute('open', '');
103
+ this.setAttribute('aria-disabled', 'false');
99
104
  (_a = __classPrivateFieldGet(this, _ModalDialogElement_instances, "a", _ModalDialogElement_overlayBackdrop_get)) === null || _a === void 0 ? void 0 : _a.classList.remove('Overlay--hidden');
100
105
  document.body.style.paddingRight = `${window.innerWidth - document.body.clientWidth}px`;
101
106
  document.body.style.overflow = 'hidden';
@@ -109,6 +114,7 @@ export class ModalDialogElement extends HTMLElement {
109
114
  if (!this.open)
110
115
  return;
111
116
  this.removeAttribute('open');
117
+ this.setAttribute('aria-disabled', 'true');
112
118
  (_b = __classPrivateFieldGet(this, _ModalDialogElement_instances, "a", _ModalDialogElement_overlayBackdrop_get)) === null || _b === void 0 ? void 0 : _b.classList.add('Overlay--hidden');
113
119
  document.body.style.paddingRight = '0';
114
120
  document.body.style.overflow = 'initial';
@@ -1 +1 @@
1
- .Overlay[popover]{border-width:0;min-width:192px;padding:0;position:absolute}.Overlay[popover]:not(:open){display:none}anchored-position{display:block}
1
+ .Overlay[popover]{border-width:0;min-width:192px;padding:0;position:absolute}.Overlay[popover]:not(:popover-open){display:none}anchored-position{display:block}
@@ -2,7 +2,7 @@
2
2
  "name": "alpha/overlay",
3
3
  "selectors": [
4
4
  ".Overlay[popover]",
5
- ".Overlay[popover]:not(:open)",
5
+ ".Overlay[popover]:not(:popover-open)",
6
6
  "anchored-position"
7
7
  ]
8
8
  }
@@ -14,11 +14,11 @@ import '@oddbird/popover-polyfill';
14
14
  const menuItemSelector = '[role="menuitem"],[role="menuitemcheckbox"],[role="menuitemradio"]';
15
15
  const popoverSelector = (() => {
16
16
  try {
17
- document.querySelector(':open');
18
- return ':open';
17
+ document.querySelector(':popover-open');
18
+ return ':popover-open';
19
19
  }
20
20
  catch (_a) {
21
- return '.\\:open';
21
+ return '.\\:popover-open';
22
22
  }
23
23
  })();
24
24
  const getMnemonicFor = (item) => { var _a; return (_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()[0].toLowerCase(); };
@@ -80,28 +80,34 @@ export default class FocusGroupElement extends HTMLElement {
80
80
  if (key === 'Up' || key === 'ArrowUp') {
81
81
  if (direction === 'vertical' || direction === 'both') {
82
82
  index -= index < 0 ? 0 : 1;
83
+ event.preventDefault();
83
84
  }
84
85
  }
85
86
  else if (key === 'Down' || key === 'ArrowDown') {
86
87
  if (direction === 'vertical' || direction === 'both') {
87
88
  index += 1;
89
+ event.preventDefault();
88
90
  }
89
91
  }
90
92
  else if (event.key === 'Left' || event.key === 'ArrowLeft') {
91
93
  if (direction === 'horizontal' || direction === 'both') {
92
94
  index -= 1;
95
+ event.preventDefault();
93
96
  }
94
97
  }
95
98
  else if (event.key === 'Right' || event.key === 'ArrowRight') {
96
99
  if (direction === 'horizontal' || direction === 'both') {
97
100
  index += 1;
101
+ event.preventDefault();
98
102
  }
99
103
  }
100
104
  else if (event.key === 'Home' || event.key === 'PageUp') {
101
105
  index = 0;
106
+ event.preventDefault();
102
107
  }
103
108
  else if (event.key === 'End' || event.key === 'PageDown') {
104
109
  index = items.length - 1;
110
+ event.preventDefault();
105
111
  }
106
112
  else if (this.mnemonics && printable.test(key)) {
107
113
  const mnemonic = key.toLowerCase();
@@ -126,9 +132,7 @@ export default class FocusGroupElement extends HTMLElement {
126
132
  if ((el === null || el === void 0 ? void 0 : el.popover) === 'auto') {
127
133
  el.showPopover();
128
134
  }
129
- else {
130
- el = (el === null || el === void 0 ? void 0 : el.parentElement) || null;
131
- }
135
+ el = (el === null || el === void 0 ? void 0 : el.parentElement) || null;
132
136
  } while (el);
133
137
  }
134
138
  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.4a184d98",
3
+ "version": "0.1.9-rc.7afa7f19",
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",
@@ -55,7 +55,7 @@
55
55
  "@github/relative-time-element": "^4.0.0",
56
56
  "@github/tab-container-element": "^3.1.2",
57
57
  "@oddbird/popover-polyfill": "^0.1.1",
58
- "@primer/behaviors": "^1.2.0"
58
+ "@primer/behaviors": "^1.3.4"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@changesets/changelog-github": "^0.4.6",
@@ -65,7 +65,7 @@
65
65
  "@github/prettier-config": "0.0.4",
66
66
  "@playwright/test": "^1.27.1",
67
67
  "@primer/css": "21.0.1",
68
- "@primer/primitives": "^7.11.7",
68
+ "@primer/primitives": "^7.11.10",
69
69
  "@rollup/plugin-node-resolve": "^13.3.0",
70
70
  "@rollup/plugin-typescript": "^8.3.3",
71
71
  "@typescript-eslint/eslint-plugin": "^5.31.0",
@@ -82,6 +82,7 @@
82
82
  "playwright": "^1.27.1",
83
83
  "postcss": "^8.4.16",
84
84
  "postcss-cli": "^10.0.0",
85
+ "postcss-custom-properties-fallback": "^1.0.2",
85
86
  "postcss-import": "^14.1.0",
86
87
  "postcss-mixins": "^9.0.3",
87
88
  "postcss-preset-env": "^7.8.0",
@@ -1692,7 +1692,13 @@
1692
1692
  "name": "subtitle",
1693
1693
  "type": "String",
1694
1694
  "default": "`nil`",
1695
- "description": "Provides dditional context for the Overlay, also setting the `aria-describedby` attribute."
1695
+ "description": "Provides additional context for the Overlay, also setting the `aria-describedby` attribute."
1696
+ },
1697
+ {
1698
+ "name": "overlay_id",
1699
+ "type": "String",
1700
+ "default": "`nil`",
1701
+ "description": "Provides the id of the overlay element so the close button can close it"
1696
1702
  },
1697
1703
  {
1698
1704
  "name": "size",
@@ -3645,6 +3645,11 @@
3645
3645
  "inspect_path": "/lookbook/inspect/primer/alpha/overlay/middle_of_page",
3646
3646
  "preview_path": "/lookbook/preview/primer/alpha/overlay/middle_of_page",
3647
3647
  "name": "middle_of_page"
3648
+ },
3649
+ {
3650
+ "inspect_path": "/lookbook/inspect/primer/alpha/overlay/middle_of_page_with_relative_container",
3651
+ "preview_path": "/lookbook/preview/primer/alpha/overlay/middle_of_page_with_relative_container",
3652
+ "name": "middle_of_page_with_relative_container"
3648
3653
  }
3649
3654
  ],
3650
3655
  "subcomponents": [
@@ -3668,7 +3673,13 @@
3668
3673
  "name": "subtitle",
3669
3674
  "type": "String",
3670
3675
  "default": "`nil`",
3671
- "description": "Provides dditional context for the Overlay, also setting the `aria-describedby` attribute."
3676
+ "description": "Provides additional context for the Overlay, also setting the `aria-describedby` attribute."
3677
+ },
3678
+ {
3679
+ "name": "overlay_id",
3680
+ "type": "String",
3681
+ "default": "`nil`",
3682
+ "description": "Provides the id of the overlay element so the close button can close it"
3672
3683
  },
3673
3684
  {
3674
3685
  "name": "size",
@@ -1411,6 +1411,11 @@
1411
1411
  "inspect_path": "/lookbook/inspect/primer/alpha/overlay/middle_of_page",
1412
1412
  "preview_path": "/lookbook/preview/primer/alpha/overlay/middle_of_page",
1413
1413
  "name": "middle_of_page"
1414
+ },
1415
+ {
1416
+ "inspect_path": "/lookbook/inspect/primer/alpha/overlay/middle_of_page_with_relative_container",
1417
+ "preview_path": "/lookbook/preview/primer/alpha/overlay/middle_of_page_with_relative_container",
1418
+ "name": "middle_of_page_with_relative_container"
1414
1419
  }
1415
1420
  ]
1416
1421
  },