Hacker News new | ask | show | jobs
by calibas 2841 days ago
What about just removing what you can't see from the DOM entirely, and load it in again when the dialog closes? Wouldn't be too hard with React or Vue. Just make it so either the page content or the modal is loaded.
2 comments

Or just throw in a CSS rule that says 'Everything not in the modal is display: none'. You don't need React or Vue for that. Just a line of CSS.
You can do that, but the visitor's scroll position would be reset, when the modal is closed.
Could save it and restore it, though that may create some other issues.