diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-19 08:50:20 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-19 08:50:20 +0300 |
commit | 70bdd01fbb3b2a99ddb4358a5fc7c7786f2769d6 (patch) | |
tree | b62505fa21f1fc87a1ad776842bcc4f8775fbd20 /src/ui/lookupwidget.c | |
parent | 4002d7198341e8b2540646c8b69ca7e8dd0840ec (diff) |
Focus cycling with Tab includes buttons
Tab/⇧Tab can be used to switch focus to any button in addition to input fields. The focused button can be activated by pressing Space or Return.
TODO: Dropdown menus get dismissed prematurely when trying to switch focus.
IssueID #231
Diffstat (limited to 'src/ui/lookupwidget.c')
-rw-r--r-- | src/ui/lookupwidget.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c index bf190d58..85217336 100644 --- a/src/ui/lookupwidget.c +++ b/src/ui/lookupwidget.c | |||
@@ -747,12 +747,19 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { | |||
747 | return iTrue; | 747 | return iTrue; |
748 | } | 748 | } |
749 | } | 749 | } |
750 | if (isVisible_Widget(w) && | 750 | /* Focus switching between URL bar and lookup results. */ |
751 | key == SDLK_DOWN && !mods && focus_Widget() == findWidget_App("url") && | 751 | if (isVisible_Widget(w)) { |
752 | numItems_ListWidget(d->list)) { | 752 | if (((key == SDLK_DOWN && !mods) || key == SDLK_TAB) && |
753 | setCursor_LookupWidget_(d, 1); /* item 0 is always the first heading */ | 753 | focus_Widget() == findWidget_App("url") && |
754 | setFocus_Widget(w); | 754 | numItems_ListWidget(d->list)) { |
755 | return iTrue; | 755 | setCursor_LookupWidget_(d, 1); /* item 0 is always the first heading */ |
756 | setFocus_Widget(w); | ||
757 | return iTrue; | ||
758 | } | ||
759 | else if (key == SDLK_TAB && isFocused_Widget(w)) { | ||
760 | setFocus_Widget(findWidget_App("url")); | ||
761 | return iTrue; | ||
762 | } | ||
756 | } | 763 | } |
757 | } | 764 | } |
758 | return processEvent_Widget(w, ev); | 765 | return processEvent_Widget(w, ev); |