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

Improved browser compatibility for table scroll #5051

Merged
merged 4 commits into from
Aug 11, 2020
Merged

Conversation

ManelBH
Copy link

@ManelBH ManelBH commented Aug 6, 2020

Fixes #5052.
Currently the table scroll uses the non-standard 'mousewheel' event which is not supported by firefox (and maybe other browsers). Changed it to the standard 'wheel' event, supported by most browsers, with a fallback to 'mousewheel' just in case.

src/traces/table/plot.js Outdated Show resolved Hide resolved
@archmoj archmoj added bug something broken community community contribution labels Aug 6, 2020
@archmoj
Copy link
Contributor

archmoj commented Aug 6, 2020

Could you please investigate why these two tests are failing?

it('bubbles scroll events iff they did not scroll a table', function() {

it('does not scroll any tables with staticPlot', function(done) {

@ManelBH
Copy link
Author

ManelBH commented Aug 6, 2020

Yeah, apparently the tests check that the 'mousewheel' event is raised so they fail when 'wheel' is used instead.

@archmoj
Copy link
Contributor

archmoj commented Aug 6, 2020

Those tests were added in #3327 so I'll request a review from @alexcjohnson.

@ManelBH
Copy link
Author

ManelBH commented Aug 6, 2020

Sorry it's my first PR and I'm not sure what's the expected thing to do in such cases, do I add a change to the test to handle the 'wheel' event?

@alexcjohnson
Copy link
Collaborator

Nice fix @ManelBH ! In fact looking around our code, we have a number of places that only 'wheel' is used, and at least one place we have a similar fallback to this:

// still seems to be some confusion about onwheel vs onmousewheel...
function attachWheelEventHandler(element, handler) {
if(!supportsPassive) {
if(element.onwheel !== undefined) element.onwheel = handler;
else if(element.onmousewheel !== undefined) element.onmousewheel = handler;

dragbox is about our oldest interactive component, and looking at the compatibility table in https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event it seems Chrome didn't get 'wheel' until v61 (late 2017) so until then it was crucial to support both flavors. However at this point we could in principle 🔪 'mousewheel' entirely.

But we don't need to clean all of that up now. It should be fine to change the test to use 'wheel'.

@archmoj
Copy link
Contributor

archmoj commented Aug 7, 2020

@ManelBH after 7f983c5 there is still one failing test:

it('bubbles scroll events iff they did not scroll a table', function() {

@archmoj
Copy link
Contributor

archmoj commented Aug 7, 2020

The no_ci tests were also passed on this branch.
💃 💃

@archmoj archmoj merged commit cfc8c2c into plotly:master Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken community community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The wheel scroll for tables doesn't work with firefox.
3 participants