Skip to content

Commit

Permalink
Retain context when opening modals on small screens (#50039)
Browse files Browse the repository at this point in the history
* Sheet

* Update changelog
  • Loading branch information
jameskoster committed Apr 25, 2023
1 parent c602985 commit 39f322a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- `parseStylesVariables()`: Refactor away from Lodash (mobile) ([#49794](https://github.com/WordPress/gutenberg/pull/49794)).
- Remove Lodash dependency from components package ([#49794](https://github.com/WordPress/gutenberg/pull/49794)).
- Tweak `WordPressComponent` type so `selector` property is optional ([#49960](https://github.com/WordPress/gutenberg/pull/49960)).
- Update `Modal` appearance on small screens ([#50039](https://github.com/WordPress/gutenberg/pull/50039)).

### Enhancements

Expand Down
14 changes: 7 additions & 7 deletions packages/components/src/modal/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@
// The modal window element.
.components-modal__frame {
// Use the entire viewport on smaller screens.
margin: 0;
margin: $grid-unit-50 0 0 0;
width: 100%;
background: $white;
box-shadow: $shadow-modal;
border-radius: $grid-unit-10;
border-radius: $grid-unit-10 $grid-unit-10 0 0;
overflow: hidden;
// Have the content element fill the vertical space yet not overflow.
display: flex;
// Animate the modal frame/contents appearing on the page.
animation: components-modal__appear-animation 0.1s ease-out;
animation-fill-mode: forwards;
@include reduce-motion("animation");

// Show a centered modal on bigger screens.
@include break-small() {
border-radius: $grid-unit-10;
margin: auto;
width: auto;
min-width: $modal-min-width;
max-width: calc(100% - #{$grid-unit-20 * 2});
max-height: calc(100% - #{$header-height * 2});

// Animate the modal frame/contents appearing on the page.
animation: components-modal__appear-animation 0.1s ease-out;
animation-fill-mode: forwards;
@include reduce-motion("animation");

&.is-full-screen {
@include break-small() {
width: calc(100% - #{ $grid-unit-20 * 2 });
Expand Down

0 comments on commit 39f322a

Please sign in to comment.