Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show sticky elements when a modal is displayed #3

Open
lykahb opened this issue Jul 18, 2018 · 0 comments
Open

Show sticky elements when a modal is displayed #3

lykahb opened this issue Jul 18, 2018 · 0 comments

Comments

@lykahb
Copy link
Owner

lykahb commented Jul 18, 2018

If the website displays a modal sticky element while blocking the scrolling, hiding that element will essentially make the website unusable. Often it is a full-screen gallery or a modal dialog.

Now modals are handled with classification the elements by size and locations that allows to display "splashes" - the elements that take the most of the screen. Classification is enough for the majority of full-screen galleries. However, it relies on the sticky element having the right size (to be classified as splash) when it is created or assigned the sticky property. If the sticky element exists and has smaller dimensions before the gallery is shown, it will be hidden and the website will freeze. There are some other cases when a modal gets hidden.

To make freezes more rare, we need to detect modals in a more robust way and, to err on the safer side, display all sticky elements once a modal is detected.

There are two solutions to improve modal detection:

  1. Improve element classification. In the general case that is a hard problem. It should involve more checks if the element is visible, that is fragile as visibility can be set with a number of properties. Here is an incomplete list of what defines if the element is visible: display, visibility, opacity, z-index, moving it outside of the screen boundaries.
  2. Check if the scroll is disabled. Here a challenge is to detect where the content is scrolled. Sticky ducky only checks for the scroll events on window and body which the absolute majority of sites have. A practical solution is to check overflow-y on html and body. It won't work on the more unusual layouts, where the entire content is scrolled within another element inside of the body.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant