@codecademy/gamut 67.4.2-alpha.b3304f.0 → 67.4.2-alpha.c20997.0
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.
|
@@ -8,7 +8,15 @@ import { ScreenreaderNavigableText } from './elements';
|
|
|
8
8
|
import { InfoTipButton } from './InfoTipButton';
|
|
9
9
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const ARIA_HIDDEN_DELAY_MS = 1000;
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
// Match native dialogs with open attribute, and role-based dialogs that aren't aria-hidden
|
|
13
|
+
const MODAL_SELECTOR = 'dialog[open],[role="dialog"]:not([aria-hidden="true"]),[role="alertdialog"]:not([aria-hidden="true"])';
|
|
14
|
+
|
|
15
|
+
// Check if an element is actually visible (not hidden via CSS)
|
|
16
|
+
const isElementVisible = element => {
|
|
17
|
+
if (!(element instanceof HTMLElement)) return false;
|
|
18
|
+
return element.checkVisibility?.() ?? true;
|
|
19
|
+
};
|
|
12
20
|
export const InfoTip = ({
|
|
13
21
|
alignment = 'top-right',
|
|
14
22
|
emphasis = 'low',
|
|
@@ -105,7 +113,7 @@ export const InfoTip = ({
|
|
|
105
113
|
const handleGlobalEscapeKey = e => {
|
|
106
114
|
if (e.key !== 'Escape') return;
|
|
107
115
|
const openModals = document.querySelectorAll(MODAL_SELECTOR);
|
|
108
|
-
const hasUnrelatedModal = Array.from(openModals).some(modal => wrapperRef.current && !modal.contains(wrapperRef.current));
|
|
116
|
+
const hasUnrelatedModal = Array.from(openModals).some(modal => isElementVisible(modal) && wrapperRef.current && !modal.contains(wrapperRef.current));
|
|
109
117
|
if (hasUnrelatedModal) return;
|
|
110
118
|
e.preventDefault();
|
|
111
119
|
e.stopPropagation();
|
|
@@ -5,6 +5,8 @@ import { ToolTipProps } from '../ToolTip';
|
|
|
5
5
|
export declare const ToolTipMock: React.FC<ToolTipProps & ComponentProps<typeof FillButton>>;
|
|
6
6
|
export declare const InfoTipInsideModalMock: React.FC<Pick<InfoTipProps, 'info' | 'placement'>>;
|
|
7
7
|
export declare const MultipleInfoTipsMock: React.FC<{
|
|
8
|
-
tips:
|
|
8
|
+
tips: (Pick<InfoTipProps, 'info' | 'placement'> & {
|
|
9
|
+
id: string;
|
|
10
|
+
})[];
|
|
9
11
|
includeOutsideElement?: boolean;
|
|
10
12
|
}>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/gamut",
|
|
3
3
|
"description": "Styleguide & Component library for Codecademy",
|
|
4
|
-
"version": "67.4.2-alpha.
|
|
4
|
+
"version": "67.4.2-alpha.c20997.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@codecademy/gamut-icons": "9.52.1",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"dist/**/[A-Z]**/[A-Z]*.js",
|
|
57
57
|
"dist/**/[A-Z]**/index.js"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "6d5c2b4a781352133e3aa27a072121c48895c896"
|
|
60
60
|
}
|