From 6379fff79d8e1afcbc223ded2d182630594038c1 Mon Sep 17 00:00:00 2001 From: bryce-carson Date: Tue, 29 Sep 2020 03:56:30 +0000 Subject: [PATCH 1/6] Fix closure of accessibility menu for click-events. --- js/ui/popupMenu.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index a618f8fb48..29fa914990 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -396,14 +396,21 @@ var PopupSwitchMenuItem = GObject.registerClass({ activate(event) { if (this._switch.mapped) this.toggle(); - - // we allow pressing space to toggle the switch - // without closing the menu + + // The accessibility menu inherits its behaviour from popupMenu, and + // needs to behave similarly to other popup menus in the top bar. + // An example is the toggle switch/button in the Notifications + // (Calendar) popup menu, which can be interacted with through click- + // events or key-presses. We want the menu to remain open if we press + // the space key, which still occurs with this commit, but to close if + // the toggle is issued with the return key. This ensures the menu does + // not close if a toggle switch is activated or deactivated with click- + // events and improves mechanical accessibility. if (event.type() == Clutter.EventType.KEY_PRESS && - event.get_key_symbol() == Clutter.KEY_space) - return; - + event.get_key_symbol() == Clutter.KEY_Return) super.activate(event); + + return; } toggle() { -- GitLab From 194d43fa0ce34c56d8ce2ad7a8b861b195023ebb Mon Sep 17 00:00:00 2001 From: bryce-carson Date: Tue, 29 Sep 2020 04:05:41 +0000 Subject: [PATCH 2/6] Edited explanation. --- js/ui/popupMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 29fa914990..88af0ec09a 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -405,7 +405,7 @@ var PopupSwitchMenuItem = GObject.registerClass({ // the space key, which still occurs with this commit, but to close if // the toggle is issued with the return key. This ensures the menu does // not close if a toggle switch is activated or deactivated with click- - // events and improves mechanical accessibility. + // events, improving human-computer interaction slightly. if (event.type() == Clutter.EventType.KEY_PRESS && event.get_key_symbol() == Clutter.KEY_Return) super.activate(event); -- GitLab From 850254e7297e4f65f5578fd174eb19803856ae37 Mon Sep 17 00:00:00 2001 From: bryce-carson Date: Tue, 29 Sep 2020 04:08:50 +0000 Subject: [PATCH 3/6] Fixed linting errors. --- js/ui/popupMenu.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 88af0ec09a..a64a740cd8 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -396,7 +396,6 @@ var PopupSwitchMenuItem = GObject.registerClass({ activate(event) { if (this._switch.mapped) this.toggle(); - // The accessibility menu inherits its behaviour from popupMenu, and // needs to behave similarly to other popup menus in the top bar. // An example is the toggle switch/button in the Notifications @@ -408,9 +407,7 @@ var PopupSwitchMenuItem = GObject.registerClass({ // events, improving human-computer interaction slightly. if (event.type() == Clutter.EventType.KEY_PRESS && event.get_key_symbol() == Clutter.KEY_Return) - super.activate(event); - - return; + super.activate(event); } toggle() { -- GitLab From b6db13b06b73c73beea5673de170b8d8e27e7044 Mon Sep 17 00:00:00 2001 From: bryce-carson Date: Tue, 29 Sep 2020 04:26:23 +0000 Subject: [PATCH 4/6] Removed unnecessary language. --- js/ui/popupMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index a64a740cd8..166759f163 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -404,7 +404,7 @@ var PopupSwitchMenuItem = GObject.registerClass({ // the space key, which still occurs with this commit, but to close if // the toggle is issued with the return key. This ensures the menu does // not close if a toggle switch is activated or deactivated with click- - // events, improving human-computer interaction slightly. + // events. if (event.type() == Clutter.EventType.KEY_PRESS && event.get_key_symbol() == Clutter.KEY_Return) super.activate(event); -- GitLab From e4bff154bec83308e56849b2ee621d4bb4e4cec0 Mon Sep 17 00:00:00 2001 From: bryce-carson Date: Tue, 29 Sep 2020 22:49:39 +0000 Subject: [PATCH 5/6] Apply 1 suggestion(s) to 1 file(s) --- js/ui/popupMenu.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 166759f163..fbcf6e1400 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -405,9 +405,11 @@ var PopupSwitchMenuItem = GObject.registerClass({ // the toggle is issued with the return key. This ensures the menu does // not close if a toggle switch is activated or deactivated with click- // events. - if (event.type() == Clutter.EventType.KEY_PRESS && - event.get_key_symbol() == Clutter.KEY_Return) - super.activate(event); + if (event.type() !== Clutter.EventType.KEY_PRESS || + event.get_key_symbol() === Clutter.KEY_Space) + return; + + super.activate(event); } toggle() { -- GitLab From b45f6b5e8615a3c025beb9a4881a62acea430c78 Mon Sep 17 00:00:00 2001 From: bryce-carson Date: Tue, 29 Sep 2020 22:52:12 +0000 Subject: [PATCH 6/6] Update popupMenu.js --- js/ui/popupMenu.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index fbcf6e1400..06951bc7ef 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -396,15 +396,9 @@ var PopupSwitchMenuItem = GObject.registerClass({ activate(event) { if (this._switch.mapped) this.toggle(); - // The accessibility menu inherits its behaviour from popupMenu, and - // needs to behave similarly to other popup menus in the top bar. - // An example is the toggle switch/button in the Notifications - // (Calendar) popup menu, which can be interacted with through click- - // events or key-presses. We want the menu to remain open if we press - // the space key, which still occurs with this commit, but to close if - // the toggle is issued with the return key. This ensures the menu does - // not close if a toggle switch is activated or deactivated with click- - // events. + // The accessibility menu remains open if the event + // is triggered by a non-keyboard input or the space + // key. if (event.type() !== Clutter.EventType.KEY_PRESS || event.get_key_symbol() === Clutter.KEY_Space) return; -- GitLab