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

[Feature Request] Support close dialog when click mask #10

Open
Deuscx opened this issue Mar 9, 2023 · 2 comments
Open

[Feature Request] Support close dialog when click mask #10

Deuscx opened this issue Mar 9, 2023 · 2 comments

Comments

@Deuscx
Copy link

Deuscx commented Mar 9, 2023

Is it able to support close-on-click-model like element-plus dialog https://element-plus.org/en-US/component/dialog.html#attributes
image

@thara003
Copy link
Contributor

thara003 commented Apr 19, 2023

Hi @xiaoluoboding,

I think I found a way to solve this problem using onClickOutside function.

Can I contribute the solution to the project?

@gsabater
Copy link

gsabater commented Apr 18, 2024

Another solution would be adding a listener on a parent element like the mask.
You can set this on the component where the palette is mounted.

This is what i did in my repository

document.body.addEventListener('click', (event) => {
  if (event.target.matches('[command-dialog-mask]')) {
    if (this.ui.show) this.hide()
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants