-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix: keep a scrollbar on document when Reveal opens #7831 #11341
fix: keep a scrollbar on document when Reveal opens #7831 #11341
Conversation
foundation#11065 was intented to avoid double scrollbars from a Reveal modal, but removing all scrollbars when the modal opens changes the page content width and the content shift. This is a regression of foundation#7831. The current solution is a mix between the two previous fixes: * Modal may have a scrollbar or not, following its content height * Body has no scrollbar and prevent any scroll * Document may have a scrollbar, following its content height (controlled in JS) Changes: * add the `zf-has-scroll` global html modifer and toggle it on Reveal opening/closing * always prevent scroll on body instead of html tag like in foundation#10583 See foundation#10791 (comment) Closes foundation#7831
Poke @isapir for review |
This does probably not respect viewport changes. |
@DanielRuf Both |
You're right, we should watch for viewport changes. I don't like doing things like this in JS but this seems to be the only solution. |
Some comments to describe that "disabled scrollbar" behavior would be useful tho. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ncoden @DanielRuf It looks fine to me though I didn't test it by running.
IMO in the edge case that the viewport changes while the Reveal is open then it's OK to show a slight shift and/or disabled scrollbar.
@isapir @DanielRuf I made the requested changes and some refactor.
|
I guess |
Doesn't it count as a |
I got my answer https://stackoverflow.com/a/23996839/4317384
Web development often sounds like biology courses. There's rule for everything and exception for every rule. |
@DanielRuf Actually I am using |
Ok. |
…lbar-7831 for v6.5.0 96141b7 docs: add doc for Reveal methods _addGlobalClasses/_removeGlobalClasses deda9dc refactor: rename Reveal internal methods for a better clarity 82a0493 fix: show/hide Reveal scrollbar on window resizing e6eb9b0 fix: keep a scrollbar on document when Reveal opens foundation#7831 Signed-off-by: Nicolas Coden <[email protected]>
Description
#11065 was intented to avoid double scrollbars from a Reveal modal, but removing all scrollbars when the modal opens changes the page content width and the content shift. This is a regression of #7831.
The current solution is a mix between the two previous fixes:
So the body content never shift, as the document has a scrollbar when a Reveal modal is open only if it already had one before.
Changes: