diff options
| -rw-r--r-- | views/mods/mod_revocation/page_form.phtml | 11 | ||||
| -rw-r--r-- | views/mods/mod_revocation/wp_footer.phtml | 21 |
2 files changed, 21 insertions, 11 deletions
diff --git a/views/mods/mod_revocation/page_form.phtml b/views/mods/mod_revocation/page_form.phtml index f7849ff..f33695c 100644 --- a/views/mods/mod_revocation/page_form.phtml +++ b/views/mods/mod_revocation/page_form.phtml @@ -182,10 +182,13 @@ if ((res.success ?? false) === false) { - let html = '<ul id="wpsg_error" class="wpsg_error">'; - (res.arError ?? []).forEach(error => { html += `<li>${error}</li>`; }); - html += '</ul>'; - msg.innerHTML = html; + // Meldungen des Servers als Text, Screenreader sagen sie an + const list = document.createElement('ul'); + list.id = 'wpsg_error'; + list.className = 'wpsg_error'; + list.setAttribute('role', 'alert'); + (res.arError ?? []).forEach(error => { const li = document.createElement('li'); li.textContent = error; list.appendChild(li); }); + msg.replaceChildren(list); msg.scrollIntoView({ behavior: 'smooth', block: 'center' }); } else { diff --git a/views/mods/mod_revocation/wp_footer.phtml b/views/mods/mod_revocation/wp_footer.phtml index bec1b82..891c959 100644 --- a/views/mods/mod_revocation/wp_footer.phtml +++ b/views/mods/mod_revocation/wp_footer.phtml @@ -85,6 +85,19 @@ }); + // Meldungen des Servers als Text, Screenreader sagen sie an + const error_list = (arError) => { + + const list = document.createElement('ul'); + list.id = 'wpsg_error'; + list.className = 'wpsg_error'; + list.setAttribute('role', 'alert'); + (arError??[]).forEach(error => { const li = document.createElement('li'); li.textContent = error; list.appendChild(li); }); + + return list; + + }; + const show_error = () => { const target = el_dialog_content.querySelector('#msg_target') || el_dialog_content; @@ -151,15 +164,9 @@ }) } ]).then(res => { if (!res.ok) throw new Error(res.status); return res.json(); }).then(res => { - let html = ''; - if ((res.success??false) === false) { - html += '<ul id="wpsg_error" class="wpsg_error">'; - (res.arError??[]).forEach(error => { html += `<li>${error}</li>`; }); - html += '</ul>'; - - el_dialog_content.querySelector('#msg_target').innerHTML = html; + el_dialog_content.querySelector('#msg_target').replaceChildren(error_list(res.arError)); el_dialog.classList.remove('loading'); |
