From ca13f08ff8131266181d4f679e7cddc2ecc8a261 Mon Sep 17 00:00:00 2001 From: David Bailes Date: Fri, 17 May 2019 11:06:49 +0100 Subject: [PATCH] Grid accessibility: incorrect focus can be read Problem: this affects NVDA and Narrator, but not Jaws. If a user moves to the Delete button and presses it to delete a label, a label is incorrectly read as the new focus - the focus remains on the Delete button. GridAx::SetCurrentCell() can be called when the Grid is not the focus, and send a focus event. Fix: In GridAx::SetCurrentCell() only send an focus event if the Grid is the focus. --- src/widgets/Grid.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/widgets/Grid.cpp b/src/widgets/Grid.cpp index 18f9101f4..36d5247ed 100644 --- a/src/widgets/Grid.cpp +++ b/src/widgets/Grid.cpp @@ -739,10 +739,12 @@ void GridAx::SetCurrentCell(int row, int col) mLastId); } - NotifyEvent(wxACC_EVENT_OBJECT_FOCUS, - mGrid->GetGridWindow(), - wxOBJID_CLIENT, - id); + if (mGrid == wxWindow::FindFocus()) { + NotifyEvent(wxACC_EVENT_OBJECT_FOCUS, + mGrid->GetGridWindow(), + wxOBJID_CLIENT, + id); + } NotifyEvent(wxACC_EVENT_OBJECT_SELECTION, mGrid->GetGridWindow(),