Skip to content

Commit

Permalink
Fix autofill not triggering events on input changes
Browse files Browse the repository at this point in the history
  • Loading branch information
buehlefs committed Oct 4, 2023
1 parent 3444568 commit fca7efc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qhana_plugin_runner/static/microfrontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,14 @@ function onAutoFillResponse(data) {
}
if (input.nodeName === "TEXTAREA") {
input.textContent = value;
input.dispatchEvent(new InputEvent("input", { data: value, cancelable: false }));
input.dispatchEvent(new InputEvent("change", { data: value, cancelable: false }));
return;
}
if (input.nodeName === "SELECT") {
input.value = value;
input.dispatchEvent(new InputEvent("input", { data: value, cancelable: false }));
input.dispatchEvent(new InputEvent("change", { data: value, cancelable: false }));
return;
}
if (input.type === "checkbox") {
Expand All @@ -160,9 +164,13 @@ function onAutoFillResponse(data) {
} else {
input.checked = false;
}
input.dispatchEvent(new InputEvent("input", { data: input.checked, cancelable: false }));
input.dispatchEvent(new InputEvent("change", { data: input.checked, cancelable: false }));
return;
}
input.value = value;
input.dispatchEvent(new InputEvent("input", { data: value, cancelable: false }));
input.dispatchEvent(new InputEvent("change", { data: value, cancelable: false }));
if (input.getAttribute("data-input-type") === "data") {
const dataInputId = input.getAttribute("id");
if (dataInputId && value) {
Expand Down

0 comments on commit fca7efc

Please sign in to comment.