Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 510 - undo can change which tracks are selected, and focus
undo can change which tracks are selected, and focus
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: Application Core
2.0.0
PC All
: P4 Accessibility
Assigned To: Default Assignee for New Bugs
:
Depends on:
Blocks: 33
  Show dependency treegraph
 
Reported: 2012-05-25 07:40 UTC by David Bailes
Modified: 2018-08-20 11:51 UTC (History)
6 users (show)

See Also:
Steps To Reproduce:
1 File > Close to clear Undo stack 2 Generate a tone. 3 Edit > Duplicate. 4 ENTER to deselect the first (focused) track 5 Open Effect > Bass and Treble (for example) then apply the effect (which gives focus to the lower track). 6 Edit > Undo. * Selected state changes (both tracks are selected) * Focus moves back to the first track 7 Edit > Redo and confirm this changes selection and focus to as it was after step 4. 8 UP arrow and ENTER to include the upper track in the selection then apply the effect again. Undo deselects the upper track and moves focus back into the lower track. The bug may also be reproduced if you select part of the track then change the selected track by using ENTER on the focused track. The bug does not reproduce if you use the mouse to change which track is selected or modify the selection after changing the track selectedness.
Release Note:
First Git SHA:
Group: Accessibility
Workaround:
Closed: 2018-08-20 00:00:00
gale: Accessibility+


Attachments
"May" fix the issue (667 bytes, patch)
2013-10-04 14:33 UTC, Leland Lucius
Details | Diff
Must more extensive review of saving state (5.44 KB, patch)
2013-10-09 22:37 UTC, Leland Lucius
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Bailes 2012-05-25 07:40:22 UTC
1. select one or more tracks, and a time range which doesn't cover all the audio.
2. perform some action on the selected audio, eg delete.
3. undo. This can change which tracks are selected and which track is the focus. Confusing for visually impaired users.
Details:
- if prior to some action, undo, one of the selected tracks is the focus, then after the undo that tracks remains selected, but any other selected tracks are deselected.
- if prior to some action, undo,  one of the selected tracks is not the focus, then after the undo, only one of the tracks remains selected, and that track becomes the focus.
Comment 1 Gale Andrews 2013-01-22 12:15:59 UTC
(In reply to comment #0)
Reproduced on Linux and Mac OS X also. 

Added Steps to Reproduce. 

AFAICT, the bug only triggers if you change which track is selected using ENTER before making the edit. 

Changing the selected track with the mouse prevents the bug occurring.

Selecting part of a track using the mouse or even doing so using the keyboard prevents the bug occurring providing you apply the edit after making that selection.  

The bug seems to have existed ever since keyboard navigation of the track was introduced.
Comment 2 Gale Andrews 2013-01-24 19:40:21 UTC
See also bug 614 "Undo undoes Mute / Solo changes" which shares a similar workaround (select in the track after changing Mute / Solo).
Comment 3 Leland Lucius 2013-10-04 14:33:24 UTC
Created attachment 400 [details]
"May" fix the issue

I believe the attached patch will correct the issues you're seeing.  But, you'll need to give it a try to make sure I was looking at it correctly.
Comment 4 David Bailes 2013-10-05 04:10:50 UTC
(In reply to comment #3)
> Created an attachment (id=400) [details]
> "May" fix the issue
> 
> I believe the attached patch will correct the issues you're seeing.  But,
> you'll need to give it a try to make sure I was looking at it correctly.

thanks Leland. The focus can also move, which isn't documented in the bug. I'm not sure whether this is because I didn't notice it, or it's been introduced since the bug was filed.

Your patch is an improvement, but things still aren't right. For example:
1. starting with no selected tracks and no selected time range.
2. select tracks
3. select time range, for example using shift+right arrow
4. delete or something.
5. undo. selection state of tracks is unchanged, but the first selected track becomes the focus.

Another example:
1. starting with no selected tracks and no selected time range.
2. select time range, for example using shift+right arrow.
3. select tracks
4. delete or something.
5. undo. All tracks become unselected, and first track is the focus.

David.
Comment 5 Leland Lucius 2013-10-09 22:37:29 UTC
Created attachment 415 [details]
Must more extensive review of saving state

Try this one David.  I reviewed all actions in Menus.cpp and have added state saving where it seemed to be missing.  I had no idea it would be so many (22).  And that was only reviewing Menus.cpp.  I believe that will get them all since all keyboard actions are tied to a menu or command action and they all go through Menus.cpp. (I still have a few to review in TrackPanel.cpp though)

Leland
Comment 6 David Bailes 2013-10-10 07:22:32 UTC
(In reply to comment #5)
> Created an attachment (id=415) [details]
> Must more extensive review of saving state
> 
> Try this one David.  I reviewed all actions in Menus.cpp and have added state
> saving where it seemed to be missing.  I had no idea it would be so many (22). 
> And that was only reviewing Menus.cpp.  I believe that will get them all since
> all keyboard actions are tied to a menu or command action and they all go
> through Menus.cpp. (I still have a few to review in TrackPanel.cpp though)

tested the patch, and so far I can't get the selection to change by pressing undo.

The focus still changes to the first selected track - maybe this is in the stuff in trackpanel which you still have to review.
(The focus change is far less a problem than the selection change, as the screen reader reads the focussed track after the undo.)

thanks,
David.
Comment 7 Leland Lucius 2013-10-23 16:26:47 UTC
Patch committed in r12721.

But, bug should state open to address the focus problem.
Comment 8 Gale Andrews 2013-10-23 17:39:32 UTC
(In reply to comment #7)
> bug should state open to address the focus problem.
Agreed. And there may be a question whether undo should legitimately move the focus after Track Drop-Down Menu > Move Track Up/Down.
Comment 9 David Bailes 2013-10-24 03:48:54 UTC
(In reply to comment #8)
 And there may be a question whether undo should legitimately move the
> focus after Track Drop-Down Menu > Move Track Up/Down.
I'm not sure what you mean. I think the desired behaviour is:
1. track "fred" is the focus.
2. fred is moved up or down, and remains the focus.
3. undo, and fred remains the focus.

David.
Comment 10 Gale Andrews 2014-04-02 03:05:05 UTC
The patch (attachment#415 [details]) may also fix bug 614.
Comment 11 Gale Andrews 2014-09-26 20:30:54 UTC
(In reply to comment #6)
David wrote:
> tested the patch, and so far I can't get the selection to change by pressing
> undo.

When I tried this fix in October and April, I still "occasionally" got the selection reverting after Undo to where it was before applying the effect, so I was a bit unsure on whether the selection reversion was fully fixed, but I can't find any problem today. I tried all classes of effect (built-in, plug-ins) and tried Generate, and also tried with clips in the track. 


> The focus still changes to the first selected track - maybe this is in the
> stuff in trackpanel which you still have to review.
> (The focus change is far less a problem than the selection change, as the
> screen reader reads the focussed track after the undo.)

I too "sometimes" got focus reverting as well as selection when I tested before, but I have not seen the focus reverting once in extensive testing today. 
Do you have steps to reproduce that? I can't make it happen with the current steps given in the "Steps To Reproduce" box. 

Meantime I demoted this to P4 as you suggest in bug 33. On reflection, probably I should have split the focus issue to a separate bug, as it meant the selection fix was never on DEVEL - FIX MADE which made it harder to track.
Comment 12 Peter Sampson 2018-08-13 11:59:27 UTC
Testing on W10 with audacity-2.3.0-alpha-86-11da92d66846706d83c4cd44a0d05ff34b0f3d4d
This no longer happens I get correct expected behaviors throughout

Same when I test on macOS 10.13.6 with 30Jul18 alpha

Un particular Step 6 does not happen as described - it behaves properly

and similarly for step 8
Comment 13 David Bailes 2018-08-15 03:58:39 UTC
(In reply to Peter Sampson from comment #12)
> Testing on W10 with
> audacity-2.3.0-alpha-86-11da92d66846706d83c4cd44a0d05ff34b0f3d4d
> This no longer happens I get correct expected behaviors throughout
> 
> Same when I test on macOS 10.13.6 with 30Jul18 alpha
> 
> Un particular Step 6 does not happen as described - it behaves properly
> 
> and similarly for step 8

The change of focus part of the bug has not been fixed: see comment 7. However, the steps to reproduce where not updated, and it may be cleaner if this bug is closed, and I open a separate bug at some stage if I still think it's a significant problem.
Comment 14 James Crook 2018-08-15 04:11:10 UTC
Thanks David.  I'd prefer a new bug, rather than a reopen, if the issue is having a bad impact on VI users and merits being a live issue.