square / maker

Maker Design System by Square
https://square.github.io/maker/styleguide/latest-stable/
Other
63 stars 14 forks source link

fix(modal,dialog): prevent unintended close for modals/dialogs when selecting text #569

Closed tatems closed 8 months ago

tatems commented 10 months ago

Describe the problem this PR addresses

When clicking and dragging to select text, if the user releases their cursor outside the modal/dialog window, the modal/dialog will close (specifically on Chrome). This is because the click event uses the hovered target on mouseup, which trips the closeOnClickOutside logic. On other browsers like Firefox, the target is the element hovered on mousedown.

Describe the changes in this PR

Other information

tatems commented 10 months ago

Still need to test on mobile

github-actions[bot] commented 10 months ago

Deployed Styleguide and Lab.

Notes
  1. Links may take a few minutes to update after PR is opened or commit is pushed.
  2. Links may become invalidated after PR is merged or closed.
  3. Links for all releases and open PRs can be found on the Maker Deploys page.