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
L.DomUtil.disableTextSelection should only disable text selection on the map container #9259
Comments
This is certainly doable. The Then, send the map's container as a parameter on calls to |
@IvanSanchez I agree. I was surprised looking through the docs it did not. I could probably submit a pull request sometime this week when I have time. |
I think it was designed this way because you're not meant to disable it permanently, only for the duration of a particular drag action. This is what Leaflet does, disabling it on the whole document because dragging cursor can go outside of the map container while continuing to affect the map, and we don't want text to be selected at the time. This seems like a bug in the draw tool you're using rather than a Leaflet issue — correct me if I'm wrong. |
@mourner This makes sense. I was conflicted if it were a leaflet bug or a Leaflet.draw bug actually. My work around is I cancel all leaflet draw tools when the leaflet map is blurred which in turn calls L.DomUtil.enableTextSelection |
…and disableTextSelection
Checklist
Steps to reproduce
I have a certain situation in an application where we have a content editable div as a search bar. The search bar is special in that we highlight special search terms as the user types. To keep track of cursor positions as the user types we deal with text selection of the document.
When you enable a draw tool and the hooks are added there is a line that L.DomUtil.disableTextSelection. This prevents the special content editable div from receiving text select start events.
I think this is a bug. I think text selection should only be disabled on the map itself and not the entire DOM document.
Expected behavior
Text select is disabled on the map
Current behavior
text selection is disabled on the entire window
Minimal example reproducing the issue
No response
Environment
The text was updated successfully, but these errors were encountered: