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
Controls' text can catch selection #6872
Comments
The controls are also highlighted on desktop after double-clicking the map area with the mouse pointer. One potential solution could be to disallow text selection using CSS .leaflet-control a {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
} Google Maps, OpenLayers and MapBox Studio embed is also using this for their controls: |
@Malvoz Even worse: with proposed code when user tries to select whole text - only some fragments get selected: |
My "potential solution" derived from rather quickly looking into how other map tools have handled this. Google Maps (embed and API) seem content in disabling selection for attribution altogether, Bing Maps is using And even if you'd be okay with disabling text selection for controls and attribution, there would still be a problem: content outside of the map viewer (unless it's embedded in an iframe) would be the next available target for text selection. So I don't think there's a quick CSS solution here, if only we had |
I see similar behavior on taphold (contextmenu) in android Chrome: |
As appeared, Leaflet/src/map/handler/Map.Tap.js Lines 40 to 43 in 32ea41b
This is not working atm, because touch events handling is currently emulated using pointer events (which was not intended btw, and still could be changed, see #7077). Anyway, I do not feel that preventing
But we could try to emulate that behavior, adding some class on |
Github has a polyfill: https://github.com/github/user-select-contain-polyfill. Perhaps Leaflet has a policy not to use polyfills, in which case it may serve as inspiration. |
Possible solution, from #5449 (comment):
|
Steps to reproduce
Steps to reproduce the behavior:
Note: holding finger on the is not dragging per se, yet this also happens to me while dragging slowly; users may also want to pause while dragging, as they explore the map.
Expected behavior
the '+' in the zoom control or text in attribution control are not selected
Current behavior
see screenshot
Environment
Additional context
I got a React app, using react-leaflet.js.org, but I can also reproduce this on leafletjs.com, as mentioned above
The text was updated successfully, but these errors were encountered: