Hey there. It looks like when I am scrolling down a page and then I click again into the div which contains de NGL, the page automatically scrolls up/down to the center of the figure.
Sometimes this behavior is annoying. Is there a way to disable it?
@arose I have created an example at https://codepen.io/pen?template=JNLMXb
In order to reproduce what I said, please scroll down until the footer, click there and then click in any black space. You should see the browser scrolling automatically trying to center the NGL view.
https://codepen.io/biharck/pen/bjOgPK
It looks like that this bug just happens on Google Chrome.
Could you please, help me?
Thanks a lot.
@arose would you mind to help me with that, please?
This is something vendor specific in my experience (happens in chrome + safari but does not happen in firefox). I am wondering if it is not a "feature" of this browser when a webGL context gets the focus.
If I trigger the focus programatically (stage.viewer.renderer.domElement.focus()) I observe the same auto scrolling of the canvas into view.
I have tried to add a focus event listener to the canvas to prevent default behaviour without any success regarding this issue.
I have found a workaround: the HTML for the canvas ahas a tabindex set to -1 which should prevent the canvas to be focusable. But this is not efficient in Chrome and programatically removing the tabindex does the job: stage.viewer.renderer.domElement.removeAttribute('tabindex')
thanks @ppillot!
Thank you @ppillot :)
Most helpful comment
I have found a workaround: the HTML for the canvas ahas a tabindex set to -1 which should prevent the canvas to be focusable. But this is not efficient in Chrome and programatically removing the tabindex does the job:
stage.viewer.renderer.domElement.removeAttribute('tabindex')