From 53a33dbe7403907a626815d9c120716dc22407a5 Mon Sep 17 00:00:00 2001 From: Gene Wood Date: Wed, 17 Jun 2026 12:33:57 -0700 Subject: [PATCH] Clear hover highlights when navigating with keyboard Keyboard navigation (arrow keys) did not clear item hover state, causing items to retain their grey hover background after the mouse left the window, resulting in multiple items appearing highlighted simultaneously. Fixes #1865 --- src/tab.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tab.rs b/src/tab.rs index 6afcfce..9c1c2e5 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -3130,6 +3130,14 @@ impl Tab { item.pos_opt.get() } + fn dehighlight_all(&mut self) { + if let Some(items) = self.items_opt.as_mut() { + for item in items.iter_mut() { + item.highlighted = false; + } + } + } + pub(crate) fn select_focus_scroll(&mut self) -> Option { let items = self.items_opt.as_ref()?; let item = items.get(self.select_focus?)?; @@ -3820,6 +3828,7 @@ impl Tab { } } Message::ItemDown => { + self.dehighlight_all(); if let Some(edit_location) = &mut self.edit_location { edit_location.select(true); } else if self.gallery { @@ -3862,6 +3871,7 @@ impl Tab { } } Message::ItemLeft => { + self.dehighlight_all(); if self.gallery { commands.append(&mut self.update(Message::GalleryPrevious, modifiers)); } else { @@ -3920,6 +3930,7 @@ impl Tab { } } Message::ItemRight => { + self.dehighlight_all(); if self.gallery { commands.append(&mut self.update(Message::GalleryNext, modifiers)); } else { @@ -3961,6 +3972,7 @@ impl Tab { } } Message::ItemUp => { + self.dehighlight_all(); if let Some(edit_location) = &mut self.edit_location { edit_location.select(false); } else if self.gallery {