From 427cefbf3f738773582ecdcc8145509a66450a43 Mon Sep 17 00:00:00 2001 From: Reza Bakhshi Laktasaraei Date: Wed, 2 Sep 2026 18:18:37 +0330 Subject: [PATCH] Pass over hidden and disabled widgets in the blocked Tab walk The layer's Tab traversal picked the next widget with a Tab focus policy without asking whether it is shown or enabled, so Tab could land on the field of a collapsed section or on a button that is faded out, where the keyboard is left on something that is not there. The default traversal skips those; do the same. --- base/qt/qt_tab_key.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/base/qt/qt_tab_key.cpp b/base/qt/qt_tab_key.cpp index 52a0aa9bdb..de173ecdba 100644 --- a/base/qt/qt_tab_key.cpp +++ b/base/qt/qt_tab_key.cpp @@ -22,7 +22,14 @@ bool FocusNextPrevChildBlocked(not_null widget, bool next) { const auto start = focused ? focused : widget.get(); auto w = skip(start); while (w && w != start) { - if ((w->focusPolicy() & Qt::TabFocus) && widget->isAncestorOf(w)) { + // Like the default traversal: a widget that is hidden or disabled + // is passed over, or Tab lands on something that is not there - + // the field of a collapsed section, or a button shown only while + // its field is focused. + if ((w->focusPolicy() & Qt::TabFocus) + && w->isVisible() + && w->isEnabled() + && widget->isAncestorOf(w)) { break; } w = skip(w);