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

"Excludes the scrollbars if present" -- should this be an option? Should they be included? #19

Open
ChumpChief opened this issue Jun 2, 2016 · 6 comments

Comments

@ChumpChief
Copy link

Code sample specifies that scrollbars should be excluded from the clientWidth/Height measurements. I agree this aligns better with some of the scenarios we've discussed (e.g. "is in view" checks, pseudo-device-fixed, etc.), but this is a divergence from the existing innerWidth/Height API behaviors. Probably worth soliciting input on.

@dbaron
Copy link
Contributor

dbaron commented Aug 16, 2016

At the very least, it's worth being clearer that the scrollbars to be excluded are only scrollbars that are outside the panning-and-zooming area, and not those inside it.

(I got here from w3ctag/design-reviews#128 .)

@bokand
Copy link
Collaborator

bokand commented Aug 22, 2016

@dbaron, just to make sure, by "outside the panning-and-zooming area" we mean the scrollbars that don't zoom or scroll with the viewport, right? i.e. The window scrollbars.

bokand added a commit that referenced this issue Apr 21, 2017
Make it clear that only scrollbars fixed to the visual viewport are
exlucded from clientWidth/clientHeight. Also make it clear that this
applies only to classic scrollbars and not overlays.

Issue #19
@bokand
Copy link
Collaborator

bokand commented Apr 21, 2017

I've clarified the spec that we should only exclude scrollbars that are fixed to the visual viewport and also that we should exclude scrollbars that are overlay.

@bokand
Copy link
Collaborator

bokand commented Apr 21, 2017

I think this would be useful as I remember running into this when writing some examples/polyfill but don't think it's necessary for V1 so I'll mark this issue as an "enhancement"

@bokand
Copy link
Collaborator

bokand commented Apr 21, 2017

A use case for this is presented in #23

EDIT: Actually, I think that use case wants to use exclude the scrollbar but was just surprised it has different behavior form innerWidth.

@Helmut-Emmelmann
Copy link

In response to Bokand´s question of Apr. 22, 17 in #23: The use case is to conceptually cover the complete document by an HTML Canvas element for drawing and as optimization to actually restrict the size of the canvas to the visible part of it. (to optimize canvas size and so WebGL performance)

I agree that here it is probably sufficient to use the size excluding the scroll bars, assuming that the scroll bars are indeed solid and not partially transparent or somehow overlaying the content.

On the other hand, in this particular use case, it is no problem if the canvas is slightly larger than the visible area, because the extra part of the canvas is just invisible, covered by the scroll bars or window border etc. So my current implementation on http://taccgl.org uses window.innerWidth / Height and does not care about the scroll bars and so also avoids problems with transparent and overlaying scrollbars.

I am also experimenting with a somewhat larger canvas to avoid flickering that appears on some devices during scrolling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants