Scrollbar always visible on the right (.cdk-global-scrollblock set on <html>)
See original GitHub issueI’m submitting a…
[X] Bug report
Current behavior
Since version 8+, in the modal layout, a blank scroll bar is always visible on the right of the gallery.
This is certainly due to the automatic adding of the ‘cdk-global-scrollblock’ class on the <html> node, maybe due to the use of BlockScrollStrategy in ModalGalleryService:getOverlayConfig. Was there a motivation to use this instead of the NoopScrollStrategy for instance?
Expected behavior
No scrollbar on the right! : )
Minimal reproduction of the problem with instructions
On https://ks89.github.io/angular-modal-gallery-2021-v9.github.io/demo/array-simple, “Examples” section, click on the 1st Live demo link.
What is the motivation / use case for changing the behavior?
The scrollbar is unused and most likely unwanted.
Environment (the most important section to fill very carefully)
The one of the demo website https://ks89.github.io/angular-modal-gallery-2021-v9.github.io/demo/array-simple, “Examples” section.
Browser:
- Chrome (desktop) version 97
- Firefox version 96
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Making the main scrollbar always visible - Stack Overflow
This makes the scrollbar always visible and only active when needed. ... An alternative approach is to set the width of the html...
Read more >How To Force (Always Show) Scrollbars With CSS - W3Schools
Learn how to always show scrollbars with CSS. ... Force / Always Show Scrollbars. Add overflow: scroll; to show both the horizontal and...
Read more >scrollbar-gutter - CSS: Cascading Style Sheets - MDN Web Docs
Classic scrollbars are always placed in a gutter, consuming space when ... The one on the left has no scroll, but the one...
Read more >How to prevent overflow scrolling in CSS - LogRocket Blog
In the image and code below, we will outline our root HTML file in red to ... Be sure to note, however, the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Indeed you’re right. Noop might not be the greatest option.
From my tests:
I don’t know about iOS smartphones, but I’d say it must be like iOS computers with invisible scrollbars?
So I think a workaround for people wanting to get rid of it on all devices would be to add in the application
styles.css:One should be careful if they’re using Cdk elsewhere in their application though.
I tried but using the NoopScrollStrategy it permits page scrolling.
Doc says: “… Note that some applications may implement special or customized page scrolling; if the BlockScrollStrategy conflicts with this kind of situation, it can be overridden by re-providing BlockScrollStrategy with a custom implementation.”.
Probably the only way to fix this is applying some customization. Did you see this issue only on Windows or does it happen also on smart phones, like iOS devices? I feel worried to change this, because I cannot test all devices.