From a2ed8ac9e6239740902ca2d5062079b2b5673e50 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 24 May 2025 22:14:01 +0200 Subject: [PATCH] Fix TAB behaviour in a panel with notebook as only active child If a panel contained a notebook and some other element(s) that didn't accept focus (e.g. because they were disabled), TAB didn't wrap around correctly. Fix this by ensuring the focus gets to the notebook itself in this case by handling it in wxNotebook itself if the parent didn't do anything. See #25443. --- src/msw/notebook.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 53292c3e08..84317e8b31 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -1660,8 +1660,14 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) else if ( parent ) { event.SetCurrentFocus(this); - parent->HandleWindowEvent(event); - } + if ( !parent->HandleWindowEvent(event) ) + { + // if the parent didn't handle this event, the notebook + // must be its only child accepting focus, so take it + event.Skip(false); + SetFocus(); + } + } } } }