Skip to content

Commit

Permalink
fix: prevent popup content from being selected on double click on the…
Browse files Browse the repository at this point in the history
… container (#2722)
  • Loading branch information
limonte authored Apr 17, 2024
1 parent 459b30c commit 7910325
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/popup-click-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ const handleModalMousedown = (domCache) => {
* @param {DomCache} domCache
*/
const handleContainerMousedown = (domCache) => {
domCache.container.onmousedown = () => {
domCache.container.onmousedown = (e) => {
// prevent the modal text from being selected on double click on the container (allowOutsideClick: false)
if (e.target === domCache.container) {
e.preventDefault()
}
domCache.popup.onmouseup = function (e) {
domCache.popup.onmouseup = () => {}
// We also need to check if the mouseup target is a child of the popup
Expand Down

0 comments on commit 7910325

Please sign in to comment.