Skip to content

Commit

Permalink
Don't create wxWindowAccessible by default
Browse files Browse the repository at this point in the history
Don't unconditionally use wxWidgets' implementation of IAccessible for
all windows when wxUSE_ACCESSIBILITY is 1, because it is inferior to the
system provided one: it often lacks appropriate labels, doesn't fully
support navigation and wxIAccessible isn't fully implemented.

The approach, when using MSAA, recommended by Microsoft documentation is
to customize accessibility for custom controls only, by proxying to the
standard and overriding what is necessary. By making this change, user
code is still allowed to customize accessibility if needed, without
negatively impacting standard controls that don't need any custom code.

See also #340
  • Loading branch information
vslavik committed Nov 20, 2016
1 parent 9c1689b commit 7dab555
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Changes in behaviour not resulting in compilation errors
for getting the micro version. If you override GetToolkitVersion() you need
to add this new third parameter.

- wxWindow::CreateAccessible() doesn't return accessible object by default
anymore and GetOrCreateAccessible() may return NULL, indicating that native
system-provided accessibility should be used.

Changes in behaviour which may result in build errors
-----------------------------------------------------

Expand Down
5 changes: 3 additions & 2 deletions include/wx/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -1449,15 +1449,16 @@ class WXDLLIMPEXP_CORE wxWindowBase : public wxEvtHandler
// ----------------------
#if wxUSE_ACCESSIBILITY
// Override to create a specific accessible object.
virtual wxAccessible* CreateAccessible();
virtual wxAccessible* CreateAccessible() { return NULL; }

// Sets the accessible object.
void SetAccessible(wxAccessible* accessible) ;

// Returns the accessible object.
wxAccessible* GetAccessible() { return m_accessible; }

// Returns the accessible object, creating if necessary.
// Returns the accessible object, calling CreateAccessible if necessary.
// May return NULL, in which case system-provide accessible is used.
wxAccessible* GetOrCreateAccessible() ;
#endif

Expand Down
6 changes: 0 additions & 6 deletions src/common/wincmn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3186,12 +3186,6 @@ wxAccessible* wxWindowBase::GetOrCreateAccessible()
return m_accessible;
}

// Override to create a specific accessible object.
wxAccessible* wxWindowBase::CreateAccessible()
{
return new wxWindowAccessible((wxWindow*) this);
}

#endif

// ----------------------------------------------------------------------------
Expand Down

0 comments on commit 7dab555

Please sign in to comment.