From bb863246249147ae950fd72a4e5f1f4469359695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Wed, 31 May 2023 20:05:20 +0200 Subject: [PATCH] Reflect JS view iframe focus state on creation --- assets/js/hooks/js_view.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assets/js/hooks/js_view.js b/assets/js/hooks/js_view.js index 8c813deeb..c5fc04b53 100644 --- a/assets/js/hooks/js_view.js +++ b/assets/js/hooks/js_view.js @@ -280,6 +280,13 @@ const JSView = { } }); + // Reflect focus based on whether there is a focused parent, this + // is later synced on "element_focused" events + this.iframe.toggleAttribute( + "data-js-focused", + !!this.el.closest(`[data-js-focused]`) + ); + // Cleanup const remove = () => {