Skip to content

Node.js based forum software built for the modern web

fix: #13617 refocus skip link after template rendering

Julian Lamf0dfd070d94f
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 268d0c3f66..44a9f6eca8 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -141,6 +141,14 @@ ajaxify.widgets = { render: render };
retry = true;
renderTemplate(url, data.templateToRender || data.template.name, data, callback);
+
+ // Refocus skip link after template rendering
+ setTimeout(() => {
+ const skipLink = document.querySelector('a[href="#content"].visually-hidden-focusable');
+ if (skipLink) {
+ skipLink.focus();
+ }
+ }, 0);
});
return true;