Media modal content disappears when the 782 pixels media query kicks in #23064
Labels
[Feature] Media
Anything that impacts the experience of managing media
Needs Technical Feedback
Needs testing from a developer perspective.
[Type] Bug
An existing feature does not function as intended
Describe the bug
When the media modal is open in the block editor and the viewport size changes (due for example to a device orientation change or just because the user shrinks the browser window) triggering the 782 pixels media query, any content in the media modal disappears. It is actually removed from the DOM.
This results in the complete inability to use the media modal. Users need to understand they have to close it and reopen it again or refresh the page, which is far from ideal.
Note: I seem to remember there was a similar issue in the past but I couldn't find it. Note also that this bug seems to happen when editing an already inserted media (e.g. replacing the image of an Image block). Doesn't seem to happen when inserting a new media.
To reproduce
I made a GIF:
The bug happens also when starting from a small viewport width and then the viewport changes to a bigger width.
Expected behavior
Content to not be removed from the media modal.
Editor version (please complete the following information):
The text was updated successfully, but these errors were encountered: