### Bug description _No response_ ### Steps to reproduce 1. Start making a range selection in Audacity 2. Switch to a different window by Alt-Tab (Cmd-Tab) 3. Go back to Audacity via Alt-Tab (Cmd-Tab) 4. Observe ### Expected behavior As soon as Audacity loses focus, selection should be aborted. ### Actual behavior When Audacity is back in focus, the selection mode is still active: moving the mouse cursor extends the selection. https://github.com/user-attachments/assets/33998c3e-c831-4e40-a37c-874bf3f8d762 ### Audacity Version master ### Operating system OS independent ### Additional context _No response_