Skip to content

[Modal] Using modal.dispose does not remove listener on "EVENT_KEYDOWN_DISMISS" from documentΒ #1978

@hallelujah

Description

@hallelujah

Describe the bug

Using modal.dispose() does not clear up the listener on EVENT_KEYDOWN_DISMISS from document
That leads to javascript errors

To Reproduce
Steps to reproduce the behavior:

Follow the instructions in the linked repository

Expected behavior

Using dispose() should clear everything created by the Modal component.

Actual behavior

document is polluted with a listener that cannot fulfill anymore its role

Show your code

Created an application instead of using tailwind-elements playground
Here is the repository: https://github.com/hallelujah/tw-elements-modal-bug

Desktop (please complete the following information):

  • OS: Mac OS X Ventura 13.5.2 (22G91)
  • Browser Chrome / Safari / Firefox
  • Version 117.0.5938.92 / Version 16.6 (18615.3.12.11.2) / Version 16.6 (18615.3.12.11.2)

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Make sure it is indeed an issue/bug report

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions