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

notifyClose does not check element's type #653

Open
PierreTurnbull opened this issue Apr 22, 2024 · 0 comments
Open

notifyClose does not check element's type #653

PierreTurnbull opened this issue Apr 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@PierreTurnbull
Copy link

Describe the bug
When notifyClose is called after open has been set to false, it dispatches "SMUIMenuSurface:closed". However element's type is not checked, which can lead to some uncatched error (note element's type is any). When the component is unmounted and the event is dispatched, it causes the following error: Tried to dipatch event without element..

To Reproduce
To reproduce the problem, start this project locally : https://github.com/PierreTurnbull/smui-bug-select-demo
Open the console. Open the select, then close the dialog. Notice the error in the console.

Expected behavior
The component should not emit events after being unmounted.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: iOS
  • Browser: Chrome
  • Version: 123.0.6312.124

Additional context
The dialog that I used is from the Flowbite library and the Select is from the SMUI library. I did so in a personal sandbox where I test diverse libraries and tools. I would not usually mix 2 distinct component libraries as it's usually simpler and more coherent to have 1. That being said it should be possible to use both.
I tried reproducing the problem with only SMUI components (SMUI dialog and SMUI select) but I could not reproduce the bug, as SMUI's dialog does not unmount its children, it only hides the dialog.
I wonder if SMUI follows some philosophy of never unmounting and instead always hiding on close. If that was the case then it would not be a bug but a misuse from my part. I have not found anything indicating this tho.
If that is not the case then I think components should handle being unmounted.

@PierreTurnbull PierreTurnbull added the bug Something isn't working label Apr 22, 2024
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
Development

No branches or pull requests

1 participant