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

Fix double-click issues in Edge and IE #6743

Merged
merged 2 commits into from
May 25, 2018

Conversation

GUI
Copy link
Contributor

@GUI GUI commented May 25, 2018

Fixes #6740

Double-clicking on the map breaks panning in Edge and IE11. The issue is that after double-clicking, Edge & IE perform a text selection within the div, so then subsequent drag actions are trying to drag the selection instead of dragging the map. This fixes it by disabling text selection within the container.

A few additional notes:

  • There are a few different ways to solve this, but it seemed like this CSS based approach was maybe the simplest. However, it's worth noting that user-select is only a working draft standard, although support seems pretty universal as long as vendor prefixes are used.
  • I looked at adding a test for this (to ensure there's no selection after double-clicking), but I wasn't quite sure how to go about that. The unit tests don't seem to have support for checking window.getSelection, and the integration tests seem focused on style things.
  • Adding this CSS to either mapboxgl-canvas-container or .mapboxgl-canvas-container .mapboxgl-canvas seems to work, so not sure if one or the other might be more appropriate. In either case, text selection still seems to work for other things, like controls or popups, since those are outside the canvas container.
  • Perhaps unrelated, but the place I added it also has a CSS selector for .mapboxgl-ctrl-nav-compass, which as far as I can tell isn't used at all in the app (only .mapboxgl-ctrl-compass seems to be used). So I'm not sure if that should be removed or cleaned up (happy to open a separate PR if so).

Thanks!

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/studio and/or @mapbox/maps-design if this PR includes style spec changes

See mapbox#6740

Double-clicking on the map breaks panning in Edge and IE11. The issue is
that after double-clicking, Edge & IE perform a text selection within
the div, so then subsequent drag actions are trying to drag the
selection instead of dragging the map. This fixes it by disabling text
selection within the container.
Copy link
Contributor

@jfirebaugh jfirebaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, looks great! I tagged on a fix for the compass control selector.

@jfirebaugh jfirebaugh merged commit e8bc616 into mapbox:master May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Double clicking to zoom in breaks map dragging/panning in Edge
2 participants