1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:37:35 +00:00

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.
This commit is contained in:
networkException 2022-02-13 11:21:20 +01:00 committed by Andreas Kling
parent daf2ebca3b
commit 4dc23c9b24

View file

@ -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);