@primer/view-components 0.50.1-rc.fd121b9f → 0.51.0-rc.3ead875d
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.
|
@@ -25,20 +25,29 @@ function dialogInvokerButtonHandler(event) {
|
|
|
25
25
|
// If the behaviour is allowed through the dialog will be shown but then
|
|
26
26
|
// quickly hidden- as if it were never shown. This prevents that.
|
|
27
27
|
event.preventDefault();
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
28
|
+
// When a <dialog> is opened with showModal() from inside a popover with popover="auto",
|
|
29
|
+
// there are two related issues:
|
|
30
|
+
//
|
|
31
|
+
// 1. In older browsers (e.g. Chrome 122), the "hide all popovers" algorithm runs when a
|
|
32
|
+
// top layer element opens, closing any ancestor popover. We must re-open those popovers.
|
|
33
|
+
// See https://github.com/whatwg/html/issues/9998,
|
|
34
|
+
// fixed by https://github.com/whatwg/html/pull/10116.
|
|
35
|
+
//
|
|
36
|
+
// 2. In newer browsers where the popover stays open, the popover="auto" behavior still
|
|
37
|
+
// interferes with the native <dialog> focus trap, causing focus to escape the dialog
|
|
38
|
+
// when tabbing past the last focusable element. Converting the popover to "manual"
|
|
39
|
+
// prevents this interference.
|
|
40
|
+
//
|
|
41
|
+
// In both cases, the fix is the same: convert ancestor auto popovers to manual.
|
|
35
42
|
let node = button;
|
|
36
43
|
let fixed = false;
|
|
37
44
|
while (node) {
|
|
38
|
-
node = node.parentElement?.closest('[popover]
|
|
45
|
+
node = node.parentElement?.closest('[popover]');
|
|
39
46
|
if (node && node.popover === 'auto') {
|
|
40
47
|
node.classList.add('dialog-inside-popover-fix');
|
|
41
48
|
node.popover = 'manual';
|
|
49
|
+
// Changing popover from "auto" to "manual" closes the popover,
|
|
50
|
+
// so we need to re-show it regardless of whether it was previously open.
|
|
42
51
|
node.showPopover();
|
|
43
52
|
fixed = true;
|
|
44
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/view-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0-rc.3ead875d",
|
|
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",
|