From 4dc23c9b240ad91e5148e52e226446b5076ee38e Mon Sep 17 00:00:00 2001 From: networkException Date: Sun, 13 Feb 2022 11:21:20 +0100 Subject: [PATCH] LibGUI: Allow breadcrumbbar segment activation using the keyboard We now interpret a breadcrumbbar segment gaining focus just as clicking on the segment, allowing keyboard navigation using the arrow keys. --- Userland/Libraries/LibGUI/Breadcrumbbar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp index 94d1ccf4db..8c0f29b591 100644 --- a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp +++ b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp @@ -87,6 +87,10 @@ void Breadcrumbbar::append_segment(String text, Gfx::Bitmap const* icon, String if (on_segment_click) on_segment_click(index); }; + button.on_focus_change = [this, index = m_segments.size()](auto has_focus, auto) { + if (has_focus && on_segment_click) + on_segment_click(index); + }; button.on_drop = [this, index = m_segments.size()](auto& drop_event) { if (on_segment_drop) on_segment_drop(index, drop_event);