From aaa56caa9cfea98fef06767e8c1bedd85fbf4199 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Wed, 1 Aug 2018 01:38:57 +1000 Subject: =?UTF-8?q?Only=20focus=20button=20if=20menu=20wasn=E2=80=99t=20hi?= =?UTF-8?q?dden=20already?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/controls.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 90a4560c..fa03a36d 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -1085,7 +1085,8 @@ const controls = { } // True toggle by default - let show = is.element(popup) && popup.hasAttribute('hidden'); + const hidden = popup.hasAttribute('hidden'); + let show = hidden; if (is.boolean(input)) { show = input; @@ -1124,7 +1125,7 @@ const controls = { setFocus.call(this, firstItem, true); } // If closing, re-focus the button - else if (!show) { + else if (!show && !hidden) { setFocus.call(this, button, is.keyboardEvent(input)); } }, -- cgit v1.2.3