Showing A Yes No Cancel Message Box

@kerrishotts I’ve noticed a weird behavior with the dialog’s close() function. I have a dialog with a text-input whose value I want to return, but upon form submit the close() fully ignores the parameters:

formEl.addEventListener("submit", () => (dlgEl as HTMLDialogElement).close(textInput.value));

When I await the dialog function, there’s no return value.

This however…

btnEl.addEventListener("click", () => (dlgEl as HTMLDialogElement).close(textInput.value));

…works correctly, so there must be an issue with the submit event. Maybe there are some internal timing issues and the dialog gets closed before the event callback is executed or something like that?

When I console.log the value inside the submit event callback it’s logging correctly. It simply gets lost on the way through the close-function:

formEl.addEventListener("submit", () => console.log(textInput.value));

Any idea what the problem could be?