Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.96k stars 992 forks source link

Tool enabling disables text selection on the entire document #1068

Open ventralnet opened 7 months ago

ventralnet commented 7 months ago

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.

This also may be a bug with L.DomUtil.disableTextSelection for leaflet

ventralnet commented 7 months ago

I submitted a bug to leaflet as well. I think a good solution would be for L.DomUtil.disableTextSelection to accept a DOM element to operate on.