Skip to content

Commit 9d87c03

Browse files
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Re-implement Modal component using HTMLDialogElement (#461)
1 parent 0ca0ee3 commit 9d87c03

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/components/Modal/Modal.module.scss

+8-3
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@
3838

3939
.root[open] {
4040
display: flex;
41-
animation: fade-in theme.$animation-duration ease-out;
41+
42+
@media (prefers-reduced-motion: no-preference) {
43+
animation: fade-in theme.$animation-duration ease-out;
44+
}
4245
}
4346

4447
.root[open]::backdrop {
4548
background: theme.$backdrop-background;
46-
animation: inherit;
49+
50+
@media (prefers-reduced-motion: no-preference) {
51+
animation: inherit;
52+
}
4753
}
4854

4955
.isRootSizeSmall {
@@ -68,7 +74,6 @@
6874
}
6975

7076
.isRootSizeAuto {
71-
width: auto;
7277
min-width: min(var(--rui-local-max-width), #{map.get(theme.$sizes, auto, min-width)});
7378
max-width: min(var(--rui-local-max-width), #{map.get(theme.$sizes, auto, max-width)});
7479
}

src/components/Modal/README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ elements manually, set the `autoFocus` prop on Modal to `false`.
727727

728728
### Interaction blocking
729729

730-
Modal can be used to block user interaction while some action is being
730+
Modal can be used to block user interaction while an action is being
731731
performed.
732732

733733
```docoff-react-preview
@@ -798,10 +798,10 @@ React.createElement(() => {
798798
Modal can be used to display forms. It is recommended to use
799799
[FormLayout](/components/FormLayout) component to layout form fields.
800800

801-
While we support only controlled components, and we encourage you to use them,
802-
it is possible to use native form and its functionality inside the modal.
803-
This might be useful when you need to use native form features like validation,
804-
submission, etc.
801+
While we support only [controlled components][controlled-components],
802+
and we encourage you to use them, it is possible to use native form and its
803+
functionality inside the modal. This might be useful when you need to use
804+
native form features like validation, submission, etc.
805805

806806
To do so, you need to set `allowPrimaryActionOnEnterKey` to `false` and remove
807807
`onClick` from the primary button. Then, you need to set `form` attribute on the
@@ -1208,6 +1208,7 @@ accessibility.
12081208
| `--rui-Modal__animation__duration` | Duration of animation used (when opening modal) |
12091209

12101210
[button-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
1211+
[controlled-components]: /docs/getting-started/usage#foundation-css
12111212
[dialog-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#attributes
12121213
[div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
12131214
[heading-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements#attributes

0 commit comments

Comments
 (0)