1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Remove Track: improvement for screen readers.

After a focused track is removed by pressing shift+c, the new focus is often not correctly read by screen readers, especially nvda.
The fixes:
1. In AudacityProject::RemoveTrack, set the new focus after the track has been deleted, rather than before. (If it is set before, then the childId can be wrong after the track is deleted.

2. In TrackPanelAx::SetFocus, send an object focus event if there are no tracks. This is so the focus is correctly set when there are no tracks after a track has been deleted.

3. In TrackPanelAx::GetFocus, given the change in 2. , only call SetFocus if the focus has changed, to avoid sending unnecessary focus events. (Screen readers are normally tolerant of this, but Window Eyes became a bit too talkative.)
This commit is contained in:
David Bailes
2017-07-04 14:26:48 +01:00
parent 5d15974fbe
commit 4de3264d60
2 changed files with 28 additions and 12 deletions

View File

@@ -49,8 +49,14 @@ TrackPanelAx::~TrackPanelAx()
std::shared_ptr<Track> TrackPanelAx::GetFocus()
{
auto focusedTrack = mFocusedTrack.lock();
if( !focusedTrack )
focusedTrack = SetFocus();
if( !focusedTrack ) {
TrackListIterator iter( mTrackPanel->GetTracks() );
focusedTrack = Track::Pointer( iter.First() );
// only call SetFocus if the focus has changed to avoid
// unnecessary focus events
if (focusedTrack)
focusedTrack = SetFocus();
}
if( !TrackNum( focusedTrack ) )
{
@@ -104,6 +110,14 @@ std::shared_ptr<Track> TrackPanelAx::SetFocus( std::shared_ptr<Track> track )
num );
}
}
else
{
NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
mTrackPanel,
wxOBJID_CLIENT,
wxACC_SELF);
}
#endif
return track;