-
Notifications
You must be signed in to change notification settings - Fork 233
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
fix: add modalId prop for Modal #780
Conversation
Run & review this pull request in StackBlitz Codeflow. |
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
It looks good to me. |
Thank you for the PR.
|
Why did we need that You have now introduce a static id called |
You are right. As for the modal outside click functionality, I have a few reasons for implementing it:
I understand your opinion against the outside click. But I would appreciate it if you could provide any suggestions for a better solution for closing a modal by outside click. |
For the outside close it was as easy as adding one line to const onAutoClose = (e: MouseEvent) => {
const target: Element = e.target as Element;
if (autoclose && target?.tagName === 'BUTTON') hide(e); // close on any button click
if (outsideclose && target === e.currentTarget) hide(e); // close on click outside
}; |
@jjagielka Thank you for your input. I just updated the Modal component. |
@shinokada I'm sorry I've noticed a small issue with the solution proposed. That handler is conditionally connected: on:click={autoclose ? onAutoClose : null} we need to change it to: on:click={onAutoClose} or on:click={autoclose || outsideclose ? onAutoClose : null} |
@jjagielka Done and thanks. |
Closes #771
π Description
Add the
modalId
prop to set the id attribute for the generated modal element.Status
β Checks
βΉ Additional Information