From 78044ad2aaa78a7b6903d2416f7838d223bfaeb2 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 13 Oct 2022 16:16:22 -0400 Subject: [PATCH] A11Y: Trap focus on auth security modal (#18573) --- app/assets/javascripts/discourse/app/controllers/auth-token.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/discourse/app/controllers/auth-token.js b/app/assets/javascripts/discourse/app/controllers/auth-token.js index 52ddce5f4de..3e089cbaf45 100644 --- a/app/assets/javascripts/discourse/app/controllers/auth-token.js +++ b/app/assets/javascripts/discourse/app/controllers/auth-token.js @@ -14,6 +14,8 @@ export default Controller.extend(ModalFunctionality, { ).then((posts) => { if (posts.length > 0) { this.set("latest_post", posts[0]); + // slightly hacky, but default d-modal focus gets reset + document.querySelector(".d-modal .modal-close")?.focus(); } }); },