Skip to content

Commit cf1a8ab

Browse files
author
John P. rouillard
committed
issue #85 - Cancel button in popup is generating valueSelected event
Change the click hander to close the popup window rather than dispatch a valueSelected event. Also since issue #68 put the button in a form, set its type=button so it doesn't become a submit button by accident. Even if it was a submit button, the form has no action so it would do nothing but.... From looking at the valueSelected method, I don't think I need to do any cleanup and can just close the window.
1 parent 850efcd commit cf1a8ab

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

html/classhelper.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,12 +761,9 @@ class ClassHelper extends HTMLElement {
761761

762762
const cancel = document.createElement("button");
763763
cancel.textContent = ClassHelper.translations["cancel"];
764+
cancel.setAttribute('type', 'button');
764765
cancel.addEventListener("click", () => {
765-
this.dispatchEvent(new CustomEvent("valueSelected", {
766-
detail: {
767-
value: preview.value
768-
}
769-
}));
766+
this.popupRef.close();
770767
});
771768

772769
const apply = document.createElement("button");

0 commit comments

Comments
 (0)