3 ms·
> automatically subtract the scrollbar width Santa: "That is simply impossible with the default scrollbar model". You may have infinite loop in layout algorit
by c-smile 4y ago
> automatically subtract the scrollbar width
Santa: "That is simply impossible with the default scrollbar model".
You may have infinite loop in layout algorithm in cases when content is close to size of the viewport.
0) remove scrollbars
1) calculate VW;
2) do content layout;
3) if content exceeds viewport height, add v-scrollbar and goto 1 if it has not the scrollbar before;
4) if content does not exceed viewport height, remove v-scrollbar and goto 1 if it has it before;
The only option is to use scrollbars that do not take space: normally scrollbar appears as thin semitransparent bar on top of content. And on mouse hover the real scrollbar appears , but again on top of content.
Such scrollbars do not cause re-layout as you see and VW is a viewport width always.
That's why in Sciter(https://sciter.com https://sciter.com) I've added
overflow:scroll-indicator;
That's exactly that non-taking-space-scrollbar.
- azangru 4y agoDear Santa, Please consult the list of gifts you brought to us for Christmas before the last. You will find included in that list the scrollbar-gutter property. With scrollbar-gutter set to stable, you could safely skip steps 3 and 4 in your algorithm, thus avoiding the infinite loop. Would you please consider giving our wish a second thought?
- c-smile 4y agoWhy do you need to waste screen space for the gutter? Check your mobile devices that use such scroll indicators. We haven't heard any major complaints about them.