Skip to content
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

Dialog: closes when 1password icon is clicked #917

Closed
rafales opened this issue Jan 15, 2024 · 4 comments · Fixed by #1114 or #1126 · May be fixed by patooworld/novel#3
Closed

Dialog: closes when 1password icon is clicked #917

rafales opened this issue Jan 15, 2024 · 4 comments · Fixed by #1114 or #1126 · May be fixed by patooworld/novel#3
Labels
bug Something isn't working

Comments

@rafales
Copy link

rafales commented Jan 15, 2024

Describe the bug

1Password - and other password managers - typically have a widget that shows up in password fields and which is appended to body.

This means that if I have a password field inside a modal and closeOnClickOutside is enabled - then clicking that widget will close the modal, which is not expected behavior.

This functionality should be probably implemented with "click on overlay" instead of catching clicks outside.

Reproduction

https://www.sveltelab.dev/b7dn7stqhkjikd0

IT WILL NOT WORK IN SVELTELAB: In SvelteLab 1password shows button in top-level page, while app itself is rendered in an iframe. So contents of an iframe never see the click on 1password button.

In order to reproduce you need 1password installed, fork this locally, then try clicking on 1password's icon next to password button.

Logs

No response

System Info

-

Severity

annoyance

@rafales rafales added the bug Something isn't working label Jan 15, 2024
@rafales
Copy link
Author

rafales commented Jan 15, 2024

melt-ui-modal-1password.mov

Here's a recording of the problem.

@huntabyte
Copy link
Member

Thanks for raising this issue! We are actively working on cleaning up the "interact outside" behavior, so ensuring this works out of the box is something we definitely want to cover (1Password user myself).

In the meantime, you should be able to get around this with something like this (not full code but you get the idea):

<script lang="ts">
const overlayId = 'myOverlayId'

const { elements: { overlay }} = createDialog({
  open: customOpen
  onOutsideClick: (e) => {
    const target  = e.target as HTMLElement
    if (target.id !== overlayId) {
      e.preventDefault()
    }
  }
})
</script>


<!-- trigger and content stuff -->
<div use:melt={$overlay} id={overlayId} />

@moreorover
Copy link

Selecting text inside input field with your mouse and dragging it outside the input field closes the dialog as well. This is related I understand.
dialog outside.webm

@huntabyte
Copy link
Member

Selecting text inside input field with your mouse and dragging it outside the input field closes the dialog as well. This is related I understand. dialog outside.webm

This is actually unrelated to this specific issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants