From 42efe53884a9159ce38d6ad2f38aceeffaaf9e6c Mon Sep 17 00:00:00 2001 From: David Bailes Date: Tue, 18 Sep 2018 15:48:56 +0100 Subject: [PATCH] Bug 1980: NVDA 2018.3 and check boxes with empty accessibility names Problem. NVDA 2018.3 does not read buttons, check boxes or radio buttons which have empty accessibility names. In fact for Scriptable dialogs which start with a check box with an empty accessibility name, none of the controls in the dialog are read. This problem is connected with the new Audacity appModule in NVDA 2018.3 which was supplied by Robert and myself. For reasons which aren't immediately obvious, it has a problem when the accessibility name of the object is empty. Fix: for check boxes which have an empty label, set the accessibility name to "\a", which is non-empty, but not read by screen readers. Note: If someone ever wanted to have buttons or radio buttons with empty labels, there could be a similar fix. But there is unlikely to be a demand for such controls. --- src/ShuttleGui.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index a09afa554..4c8b33972 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -313,7 +313,15 @@ wxCheckBox * ShuttleGuiBase::AddCheckBox( const wxString &Prompt, const wxString mpWind = pCheckBox = safenew wxCheckBox(GetParent(), miId, realPrompt, wxDefaultPosition, wxDefaultSize, Style( 0 )); pCheckBox->SetValue(Selected == wxT("true")); - pCheckBox->SetName(wxStripMenuCodes(Prompt)); + if (realPrompt.IsEmpty()) { + // NVDA 2018.3 does not read controls which are buttons, check boxes or radio buttons which have + // an accessibility name which is empty. Bug 1980. +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + pCheckBox->SetAccessible(safenew WindowAccessible(pCheckBox)); +#endif + pCheckBox->SetName(wxT("\a")); // non-empty string which screen readers do not read + } UpdateSizers(); return pCheckBox; }