@khanacademy/wonder-blocks-modal 6.0.0 → 6.0.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @khanacademy/wonder-blocks-modal
2
2
 
3
+ ## 6.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0955be7e: - ModalBackdrop: Change initial focus behavior. Focus on the dismiss button (X) by default.
8
+
9
+ - CloseButton: Override `:focus` styles on the dismiss button to make it visually distinct when the focus is set programmatically.
10
+
11
+ - Updated dependencies [f4abd572]
12
+ - Updated dependencies [0955be7e]
13
+ - @khanacademy/wonder-blocks-core@9.0.0
14
+ - @khanacademy/wonder-blocks-icon-button@6.0.1
15
+ - @khanacademy/wonder-blocks-breadcrumbs@3.0.1
16
+ - @khanacademy/wonder-blocks-layout@3.0.1
17
+ - @khanacademy/wonder-blocks-typography@3.0.1
18
+
3
19
  ## 6.0.0
4
20
 
5
21
  ### Major Changes
@@ -5,7 +5,8 @@ type Props = {
5
5
  onCloseModal: () => unknown;
6
6
  /**
7
7
  * The selector for the element that will be focused when the dialog shows.
8
- * When not set, the first tabbable element within the dialog will be used.
8
+ * When not set, the first tabbable element within the dialog will be used,
9
+ * which usually is the dismiss button (X).
9
10
  */
10
11
  initialFocusId?: string;
11
12
  /**
package/dist/es/index.js CHANGED
@@ -26,7 +26,9 @@ const theme$1 = {
26
26
  }
27
27
  },
28
28
  border: {
29
- radius: tokens.border.radius.medium_4
29
+ radius: tokens.border.radius.medium_4,
30
+ width: tokens.border.width.thin,
31
+ color: tokens.color.blue
30
32
  },
31
33
  spacing: {
32
34
  dialog: {
@@ -304,7 +306,7 @@ class FocusTrap extends React.Component {
304
306
 
305
307
  const ModalLauncherPortalAttributeName = "data-modal-launcher-portal";
306
308
 
307
- const FOCUSABLE_ELEMENTS = 'a[href], details, input, textarea, select, button:not([aria-label^="Close"])';
309
+ const FOCUSABLE_ELEMENTS = "a[href], details, input, textarea, select, button";
308
310
  function findFocusableNodes(root) {
309
311
  return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS));
310
312
  }
@@ -709,7 +711,14 @@ const themedStylesFn = theme => ({
709
711
  position: "absolute",
710
712
  right: theme.spacing.panel.closeButton,
711
713
  top: theme.spacing.panel.closeButton,
712
- zIndex: 1
714
+ zIndex: 1,
715
+ ":focus": {
716
+ outlineWidth: theme.border.width,
717
+ outlineColor: theme.border.color,
718
+ outlineOffset: 1,
719
+ outlineStyle: "solid",
720
+ borderRadius: theme.border.radius
721
+ }
713
722
  },
714
723
  dark: {
715
724
  background: theme.color.bg.inverse,
package/dist/index.js CHANGED
@@ -56,7 +56,9 @@ const theme$1 = {
56
56
  }
57
57
  },
58
58
  border: {
59
- radius: tokens__namespace.border.radius.medium_4
59
+ radius: tokens__namespace.border.radius.medium_4,
60
+ width: tokens__namespace.border.width.thin,
61
+ color: tokens__namespace.color.blue
60
62
  },
61
63
  spacing: {
62
64
  dialog: {
@@ -334,7 +336,7 @@ class FocusTrap extends React__namespace.Component {
334
336
 
335
337
  const ModalLauncherPortalAttributeName = "data-modal-launcher-portal";
336
338
 
337
- const FOCUSABLE_ELEMENTS = 'a[href], details, input, textarea, select, button:not([aria-label^="Close"])';
339
+ const FOCUSABLE_ELEMENTS = "a[href], details, input, textarea, select, button";
338
340
  function findFocusableNodes(root) {
339
341
  return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS));
340
342
  }
@@ -739,7 +741,14 @@ const themedStylesFn = theme => ({
739
741
  position: "absolute",
740
742
  right: theme.spacing.panel.closeButton,
741
743
  top: theme.spacing.panel.closeButton,
742
- zIndex: 1
744
+ zIndex: 1,
745
+ ":focus": {
746
+ outlineWidth: theme.border.width,
747
+ outlineColor: theme.border.color,
748
+ outlineOffset: 1,
749
+ outlineStyle: "solid",
750
+ borderRadius: theme.border.radius
751
+ }
743
752
  },
744
753
  dark: {
745
754
  background: theme.color.bg.inverse,
@@ -13,6 +13,8 @@ declare const theme: {
13
13
  };
14
14
  border: {
15
15
  radius: number;
16
+ width: number;
17
+ color: string;
16
18
  };
17
19
  spacing: {
18
20
  dialog: {
@@ -16,6 +16,8 @@ declare const theme: {
16
16
  };
17
17
  border: {
18
18
  radius: number;
19
+ width: number;
20
+ color: string;
19
21
  };
20
22
  spacing: {
21
23
  dialog: {
@@ -23,6 +23,8 @@ export declare const ModalDialogThemeContext: React.Context<{
23
23
  };
24
24
  border: {
25
25
  radius: number;
26
+ width: number;
27
+ color: string;
26
28
  };
27
29
  spacing: {
28
30
  dialog: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-modal",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "design": "v2",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,14 +16,14 @@
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
18
  "@babel/runtime": "^7.18.6",
19
- "@khanacademy/wonder-blocks-breadcrumbs": "^3.0.0",
20
- "@khanacademy/wonder-blocks-core": "^8.0.0",
21
- "@khanacademy/wonder-blocks-icon-button": "^6.0.0",
22
- "@khanacademy/wonder-blocks-layout": "^3.0.0",
19
+ "@khanacademy/wonder-blocks-breadcrumbs": "^3.0.1",
20
+ "@khanacademy/wonder-blocks-core": "^9.0.0",
21
+ "@khanacademy/wonder-blocks-icon-button": "^6.0.1",
22
+ "@khanacademy/wonder-blocks-layout": "^3.0.1",
23
23
  "@khanacademy/wonder-blocks-theming": "^3.0.0",
24
24
  "@khanacademy/wonder-blocks-timing": "^6.0.0",
25
25
  "@khanacademy/wonder-blocks-tokens": "^3.0.0",
26
- "@khanacademy/wonder-blocks-typography": "^3.0.0"
26
+ "@khanacademy/wonder-blocks-typography": "^3.0.1"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@phosphor-icons/core": "^2.0.2",
@@ -32,7 +32,7 @@
32
32
  "react-dom": "18.2.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@khanacademy/wonder-blocks-breadcrumbs": "^3.0.0",
35
+ "@khanacademy/wonder-blocks-breadcrumbs": "^3.0.1",
36
36
  "@khanacademy/wb-dev-build-settings": "^2.0.0"
37
37
  }
38
38
  }