1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-09 08:31:13 +02:00

Accessibility: make Grid accessible using Narrator

Problem:
Using the Narrator screen reader on Windows 10:
1. Narrator does not read the uneditable cells in the tag column of the Metadata editor.
2. In one or more versions of Windows 10 prior to 1809, Narrator's focus was incorrect after editing a cell.

Fixes:
1. Fixed by adding wxACC_STATE_SYSTEM_FOCUSED to the state.
2. Corrected GridAx::GetFocus().
This commit is contained in:
David Bailes 2019-03-25 11:42:30 +00:00
parent 26cf3aba95
commit 8c10682145

View File

@ -859,7 +859,10 @@ wxAccStatus GridAx::GetState(int childId, long *state)
wxACC_STATE_SYSTEM_SELECTED;
if (mGrid->IsReadOnly(row, col)) {
flag = wxACC_STATE_SYSTEM_UNAVAILABLE;
// It would be more logical to also include the state
// wxACC_STATE_SYSTEM_FOCUSABLE, but this causes Window-Eyes to
// no longer read the cell as disabled
flag = wxACC_STATE_SYSTEM_UNAVAILABLE | wxACC_STATE_SYSTEM_FOCUSED;
}
#endif
@ -925,9 +928,17 @@ wxAccStatus GridAx::Select(int childId, wxAccSelectionFlags selectFlags)
// If childId is 0 and child is NULL, no object in
// this subhierarchy has the focus.
// If this object has the focus, child should be 'this'.
wxAccStatus GridAx::GetFocus(int * WXUNUSED(childId), wxAccessible **child)
wxAccStatus GridAx::GetFocus(int * childId, wxAccessible **child)
{
*child = this;
if (mGrid == wxWindow::FindFocus()) {
if (mGrid->GetNumberRows() * mGrid->GetNumberCols() == 0) {
*child = this;
}
else {
*childId = mGrid->GetGridCursorRow()*mGrid->GetNumberCols() +
mGrid->GetGridCursorCol() + 1;
}
}
return wxACC_OK;
}