Skip to content

Coloris inside a dialog triggers dialog's close event #176

@fabian-mcfly

Description

@fabian-mcfly

Coloris/src/coloris.js

Lines 534 to 535 in 5b79ac1

// Trigger a "close" event
prevEl.dispatchEvent(new Event('close', { bubbles: true }));

With this code, Coloris dispatches an event that will cause issues if it's inside a dialog.
The dialog itself has a close event (https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/close_event) which might be used to remove it's contents or whatever a user wants to do with it.

Since Coloris sends that ambiguous event name, the dialog might not be closed but still execute attached event listeners.

You might want to rename this to something unique, like you do with coloris:pick

document.dispatchEvent(new CustomEvent('coloris:pick', { detail: { color, currentEl } }));

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions