-
Notifications
You must be signed in to change notification settings - Fork 327
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
Prevent horizontal jump as scrollbars appear #1230
Conversation
Woop 🎉 |
2db6212
to
ba2aa4a
Compare
Further testing on Windows 8 (using the non-desktop "tablet mode" Internet Explorer) shows that scroll bars will hide by default without: // Force IE10-11 scroll bar in "tablet" mode
-ms-overflow-style: scrollbar; Added it back in. That said, there is no visual jump here as tablet mode IE draws the scroll bars on top of the content before fading away automatically. Could still remove this. |
ba2aa4a
to
cc22ea4
Compare
I've done some more testing today of "tablet mode" on Windows 10. In Microsoft Edge (and the touch-optimised Internet Explorer on Windows 8/8.1) scroll bars are designed to auto-hide without taking up any horizontal space. Just like iOS and macOS Safari. Video demo showing auto-hiding scrollbarsI'd prefer to adhere to the device's defaults and retain this behaviour. For example, on touch-first hardware running iOS, Android, Windows 10 in S mode or "tablet mode" we should prefer auto-hiding scroll bars (same with macOS with a trackpad or magic mouse). So I've removed: // Force IE10-11 scroll bar in "tablet" mode
-ms-overflow-style: scrollbar; This pull now removes the horizontal jump in IE/Edge and when scroll bars are enabled on macOS, but without harming "tablet mode" IE/Edge and others with auto-hiding scroll bars. |
Additional browser testing completed above #1230 (comment) |
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.
I've tested this in browsers too and can see nothing odd.
Given that this behaviour is also in the legacy GOV.UK Template project too, I think we should get this merged.
Will need a second review.
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.
Great work as ever. Thanks, @colinrotherham 👏
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.
Excellent, thanks as always 👍
Since Firefox and Chrome on macOS will also obey the "Always" option when toggling "Show scroll bars", they also get the "visible but disabled" scroll bars—preventing the jump. So we've prevented the visual jump in more than just IE: Firefox 65 (with fix)With scroll bars enabled, horizontal space is reserved Firefox 65 (without fix)With scroll bars enabled, horizontal space is not reserved Browsers that auto-hide scroll bars are unaffected 👍 |
Thanks @NickColley @dashouse @36degrees 😊 |
govuk-frontend v2.8.0 introduces an overflow-y: scroll for govuk-template that needs to be overwritten when the modal opens otherwise the content will scroll behind the modal. alphagov/govuk-frontend#1230
govuk-frontend v2.8.0 introduces an overflow-y: scroll for govuk-template that needs to be overwritten when the modal opens otherwise the content will scroll behind the modal. alphagov/govuk-frontend#1230
govuk-frontend v2.8.0 introduces an overflow-y: scroll for govuk-template that needs to be overwritten when the modal opens otherwise the content will scroll behind the modal. alphagov/govuk-frontend#1230
Quick question: does anyone know if it's possible to achieve the same effect by moving this logic to the |
@alex-ju I think the By using |
@colinrotherham ok, thanks for clarifying this. |
As discussed previously with @NickColley, we're seeing horizontal "jumps" in position as scroll bars appear and disappear in IE11—as page content grows.
Also spotted by @edwardhorsford here: #1204
We've fixed the issue manually (screen-only, not affecting print) by using:
Also found in GOV.UK Template:
https://github.com/alphagov/govuk_template/blob/f2c10fae7ec7e371fd11c409cd71a399e3342e7f/source/assets/stylesheets/_basic.scss#L111
And inside GOV.UK Elements:
https://github.com/alphagov/govuk_elements/blob/84f485f688e7f796a4c44dd73b17177e8e39538c/assets/sass/elements/_govuk-template-base.scss#L50
Things to discuss:
1. Do we need to restrict to
@media only screen
Does this prevent printable content from being hidden?
2. Do we need the old-ms-overflow-style: scrollbar
styleTo force the scrollbar to always display in IE10/11Confirmed: Point 2) was previously required for "tablet mode" Internet Explorer that first came with Windows 8, but since scroll bars auto-hide by default it's not needed anymore.
Browser testing
Specific screenshots:
Edge 17 with fix
Edge 17 without fix
IE11 with fix
IE11 without fix
IE10 with fix
IE10 without fix
IE9 with fix
IE9 without fix