We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7718ad1 commit ae5dc44Copy full SHA for ae5dc44
blocks/form/form.js
@@ -7,7 +7,6 @@ async function createForm(formHref, submitHref) {
7
const json = await resp.json();
8
9
const form = document.createElement('form');
10
- // eslint-disable-next-line prefer-destructuring
11
form.dataset.action = submitHref;
12
13
const fields = await Promise.all(json.data.map((fd) => createField(fd, form)));
@@ -107,4 +106,12 @@ export default async function decorate(block) {
107
106
}
108
109
});
+
110
+ window.addEventListener('pageshow', (event) => {
111
+ if (event.persisted) {
112
+ // re-enable form submission when back button is used
113
+ const submit = form.querySelector('button[type="submit"]');
114
+ if (submit) submit.disabled = false;
115
+ }
116
+ });
117
0 commit comments