From e38fcd6deac9a63654fb0eb61fffa9ad747e4c50 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Sat, 13 Apr 2019 22:36:15 +0200 Subject: Fix button focus issues This change introduces derived classes for ComboButton, DropDownButton and Select that make sure that buttons do not remain focused after their menus are closed. This allows using hotkeys after closing them. --- js/form/ComboButton.js | 12 ++++++++++++ js/form/DropDownButton.js | 12 ++++++++++++ js/form/Select.js | 8 ++++++++ js/prefs.js | 5 ++++- js/tt-rss.js | 5 ++++- 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100755 js/form/ComboButton.js create mode 100755 js/form/DropDownButton.js create mode 100755 js/form/Select.js (limited to 'js') diff --git a/js/form/ComboButton.js b/js/form/ComboButton.js new file mode 100755 index 000000000..1084cda9c --- /dev/null +++ b/js/form/ComboButton.js @@ -0,0 +1,12 @@ +/* global dijit */ +define(["dojo/_base/declare", "dijit/form/ComboButton"], function (declare) { + return declare("fox.form.ComboButton", dijit.form.ComboButton, { + startup: function() { + this.inherited(arguments); + this.dropDown.autoFocus = true; // Allow dropdown menu to be focused on click + }, + focus: function() { + return; // Stop dijit.form.ComboButton from keeping focus after closing the menu + }, + }); +}); diff --git a/js/form/DropDownButton.js b/js/form/DropDownButton.js new file mode 100755 index 000000000..0c182772a --- /dev/null +++ b/js/form/DropDownButton.js @@ -0,0 +1,12 @@ +/* global dijit */ +define(["dojo/_base/declare", "dijit/form/DropDownButton"], function (declare) { + return declare("fox.form.DropDownButton", dijit.form.DropDownButton, { + startup: function() { + this.inherited(arguments); + this.dropDown.autoFocus = true; // Allow dropdown menu to be focused on click + }, + focus: function() { + return; // Stop dijit.form.DropDownButton from keeping focus after closing the menu + }, + }); +}); diff --git a/js/form/Select.js b/js/form/Select.js new file mode 100755 index 000000000..c62db1821 --- /dev/null +++ b/js/form/Select.js @@ -0,0 +1,8 @@ +/* global dijit */ +define(["dojo/_base/declare", "dijit/form/Select"], function (declare) { + return declare("fox.form.Select", dijit.form.Select, { + focus: function() { + return; // Stop dijit.form.Select from keeping focus after closing the menu + }, + }); +}); diff --git a/js/prefs.js b/js/prefs.js index 69b7899ec..844ce8c8a 100755 --- a/js/prefs.js +++ b/js/prefs.js @@ -54,7 +54,10 @@ require(["dojo/_base/kernel", "fox/PrefFeedTree", "fox/PrefFilterTree", "fox/PrefLabelTree", - "fox/Toolbar"], function (dojo, declare, ready, parser, AppBase) { + "fox/Toolbar", + "fox/form/Select", + "fox/form/ComboButton", + "fox/form/DropDownButton"], function (dojo, declare, ready, parser, AppBase) { ready(function () { try { diff --git a/js/tt-rss.js b/js/tt-rss.js index 5db742f07..bf0434a95 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -55,7 +55,10 @@ require(["dojo/_base/kernel", "fox/Article", "fox/FeedStoreModel", "fox/FeedTree", - "fox/Toolbar"], function (dojo, declare, ready, parser, AppBase) { + "fox/Toolbar", + "fox/form/Select", + "fox/form/ComboButton", + "fox/form/DropDownButton"], function (dojo, declare, ready, parser, AppBase) { ready(function () { try { -- cgit v1.2.3