diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-08-26 20:37:00 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-08-26 21:03:54 +0300 |
| commit | 4ba79d94ac9013630a4944a0dc89e2172656268f (patch) | |
| tree | 38c02be4bb30d98ce2b3655e10aed8688fff7cbd /src/input | |
| parent | d4dad2939d0c20a00e430e3e5ce185453bc09739 (diff) | |
| download | niri-4ba79d94ac9013630a4944a0dc89e2172656268f.tar.gz niri-4ba79d94ac9013630a4944a0dc89e2172656268f.tar.bz2 niri-4ba79d94ac9013630a4944a0dc89e2172656268f.zip | |
input: Don't hide overlays on a11y-consumed key presses
Diffstat (limited to 'src/input')
| -rw-r--r-- | src/input/mod.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index af674e03..724825e1 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -119,11 +119,12 @@ impl State { let hide_exit_confirm_dialog = self.niri.exit_confirm_dialog.is_open() && should_hide_exit_confirm_dialog(&event); + let mut consumed_by_a11y = false; use InputEvent::*; match event { DeviceAdded { device } => self.on_device_added(device), DeviceRemoved { device } => self.on_device_removed(device), - Keyboard { event } => self.on_keyboard::<I>(event), + Keyboard { event } => self.on_keyboard::<I>(event, &mut consumed_by_a11y), PointerMotion { event } => self.on_pointer_motion::<I>(event), PointerMotionAbsolute { event } => self.on_pointer_motion_absolute::<I>(event), PointerButton { event } => self.on_pointer_button::<I>(event), @@ -149,6 +150,12 @@ impl State { Special(_) => (), } + // Don't hide overlays if consumed by a11y, so that you can use the screen reader + // navigation keys. + if consumed_by_a11y { + return; + } + // Do this last so that screenshot still gets it. if hide_hotkey_overlay && self.niri.hotkey_overlay.hide() { self.niri.queue_redraw_all(); @@ -326,7 +333,11 @@ impl State { .is_some_and(KeyboardShortcutsInhibitor::is_active) } - fn on_keyboard<I: InputBackend>(&mut self, event: I::KeyboardKeyEvent) { + fn on_keyboard<I: InputBackend>( + &mut self, + event: I::KeyboardKeyEvent, + consumed_by_a11y: &mut bool, + ) { let mod_key = self.backend.mod_key(&self.niri.config.borrow()); let serial = SERIAL_COUNTER.next_serial(); @@ -360,6 +371,7 @@ impl State { event.key_code(), event.state(), ) { + *consumed_by_a11y = true; return; } |
