Fix accessible label of checkboxes broken by recent changes

The fix for wxCheckBox accessibility in dark mode in b5ea9cfe86 (Fix
wxCheckBox and wxRadioButton accessibility in wxMSW dark mode,
2026-02-13) broke getting their label in the screen readers as this was
broken by default in wxWindowAccessible::GetName() which has started
being used for them.

Fix this by returning the label and not the (internal) name of the
control from wxWindowAccessible::GetName() by default, instead of only
doing this for wxButton.

See #26184, #26187.

Closes #26270.
This commit is contained in:
Quin Gillespie
2026-03-06 17:21:48 +01:00
committed by Vadim Zeitlin
parent 583d7d6c33
commit 85c436dcc4
+1 -9
View File
@@ -3887,15 +3887,7 @@ wxAccStatus wxWindowAccessible::GetName(int childId, wxString* name)
if (childId > 0)
return wxACC_NOT_IMPLEMENTED;
// This will eventually be replaced by specialised
// accessible classes, one for each kind of wxWidgets
// control or window.
#if wxUSE_BUTTON
if (wxDynamicCast(GetWindow(), wxButton))
title = ((wxButton*) GetWindow())->GetLabel();
else
#endif
title = GetWindow()->GetName();
title = GetWindow()->GetLabel();
if (!title.empty())
{