@primer/view-components 0.32.0-rc.ae50af33 → 0.32.1-rc.0adf06d8

Sign up to get free protection for your applications and to get access to all the features.
@@ -147,7 +147,7 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
147
147
  const dialogInvoker = item.closest('[data-show-dialog-id]');
148
148
  if (dialogInvoker) {
149
149
  const dialog = this.ownerDocument.getElementById(dialogInvoker.getAttribute('data-show-dialog-id') || '');
150
- if (dialog && this.contains(dialogInvoker) && this.contains(dialog)) {
150
+ if (dialog && this.contains(dialogInvoker)) {
151
151
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleDialogItemActivated).call(this, event, dialog);
152
152
  return;
153
153
  }
@@ -289,20 +289,33 @@ _ActionMenuElement_handleInvokerActivated = function _ActionMenuElement_handleIn
289
289
  }
290
290
  };
291
291
  _ActionMenuElement_handleDialogItemActivated = function _ActionMenuElement_handleDialogItemActivated(event, dialog) {
292
- this.querySelector('.ActionListWrap').style.display = 'none';
292
+ if (this.contains(dialog)) {
293
+ this.querySelector('.ActionListWrap').style.display = 'none';
294
+ }
293
295
  const dialog_controller = new AbortController();
294
296
  const { signal } = dialog_controller;
295
297
  const handleDialogClose = () => {
296
298
  dialog_controller.abort();
297
- this.querySelector('.ActionListWrap').style.display = '';
298
- if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isOpen).call(this)) {
299
- __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_hide).call(this);
299
+ if (this.contains(dialog)) {
300
+ this.querySelector('.ActionListWrap').style.display = '';
301
+ if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isOpen).call(this)) {
302
+ __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_hide).call(this);
303
+ }
300
304
  }
301
305
  const activeElement = this.ownerDocument.activeElement;
302
306
  const lostFocus = this.ownerDocument.activeElement === this.ownerDocument.body;
303
307
  const focusInClosedMenu = this.contains(activeElement);
304
- if (lostFocus || focusInClosedMenu) {
305
- setTimeout(() => this.invokerElement?.focus(), 0);
308
+ const focusInDialog = dialog.contains(activeElement);
309
+ if (lostFocus || focusInClosedMenu || focusInDialog) {
310
+ setTimeout(() => {
311
+ // if the activeElement has changed after a task, then it's likely
312
+ // that other JS has tried to shift focus. We should respect that
313
+ // focus shift as long as it's not back at the document.
314
+ const newActiveElement = this.ownerDocument.activeElement;
315
+ if (newActiveElement === activeElement || newActiveElement === this.ownerDocument.body) {
316
+ this.invokerElement?.focus();
317
+ }
318
+ }, 0);
306
319
  }
307
320
  };
308
321
  // a modal <dialog> element will close all popovers
@@ -1 +1 @@
1
- anchored-position[popover]{border-width:0;min-width:192px;overflow:visible;padding:0;position:absolute}anchored-position:not(.Overlay){background:none}.Overlay[popover]:not(:popover-open){display:none}anchored-position.not-anchored::backdrop,dialog::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}@media (forced-colors:active){.Overlay{outline:1px solid #0000}}
1
+ anchored-position[popover]{border-width:0;min-width:192px;overflow:visible;padding:0;position:absolute}anchored-position:not(.Overlay){background:none}.Overlay[popover]:not(:popover-open){display:none}anchored-position.not-anchored::backdrop,dialog::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}select-panel dialog::backdrop{background:none}@media (forced-colors:active){.Overlay{outline:1px solid #0000}}
@@ -6,6 +6,7 @@
6
6
  ".Overlay[popover]:not(:popover-open)",
7
7
  "anchored-position.not-anchored::backdrop",
8
8
  "dialog::backdrop",
9
+ "select-panel dialog::backdrop",
9
10
  ".Overlay"
10
11
  ]
11
12
  }
@@ -19,7 +19,6 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
19
19
  var _PrimerTextFieldElement_abortController;
20
20
  import '@github/auto-check-element';
21
21
  import { controller, target } from '@github/catalyst';
22
- const SCREENREADER_TEXT_CLASSNAME = 'spinner-screenreader-text';
23
22
  let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
24
23
  constructor() {
25
24
  super(...arguments);
@@ -84,12 +83,10 @@ let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
84
83
  }
85
84
  showLeadingSpinner() {
86
85
  this.leadingSpinner?.removeAttribute('hidden');
87
- this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.removeAttribute('hidden');
88
86
  this.leadingVisual?.setAttribute('hidden', '');
89
87
  }
90
88
  hideLeadingSpinner() {
91
89
  this.leadingSpinner?.setAttribute('hidden', '');
92
- this.leadingSpinner?.querySelector(SCREENREADER_TEXT_CLASSNAME)?.setAttribute('hidden', '');
93
90
  this.leadingVisual?.removeAttribute('hidden');
94
91
  }
95
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/view-components",
3
- "version": "0.32.0-rc.ae50af33",
3
+ "version": "0.32.1-rc.0adf06d8",
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",