Inwerpsel / use-theme-editor

A React theme editor
GNU General Public License v3.0
4 stars 0 forks source link

Make full height frame usable when main scrollable content is not the root element #72

Open Inwerpsel opened 1 month ago

Inwerpsel commented 1 month ago

Some sites make the root element fixed (or not overflowing the window height), so that the full height preview is not able to have the full height. Instead, it will look identical to the main inspection frame.

This happens for the halfmoon demo (they now don't do this in v2), and several other pages from major live sites that I tested locally.

notactuallyfullheight

Afaik, there's no advantage to doing this, you can achieve the same effect by making secondary elements fixed or sticky.

This pattern has some serious drawbacks, mainly that upon refreshing the page the browser is not able to restore the scroll position in the same way it would normally do on the main content. For the user this is extremely confusing, as the page looks exactly like a normal page with fixed elements which would restore the position.

Nevertheless, it would be nice to make the full height view work anyway for such cases, as it's always a lot of work to change how scrolling works and needs a lot of testing.

If the code has to detect this case anyway, it can also notify the user that this has to be addressed. This would need some thinking of how to detect and present a list of antipatterns to the user.

If this is handled, the same logic can probably be used to sync the scroll position of (non-main) fixed elements, most commonly a sidebar menu with many entries.