Skip to content

fix: prevent navigation and focus issues by checking route state#922

Merged
PartyDonut merged 1 commit intoDonutWare:developfrom
schembriaiden:fix/escape-close-modal
Apr 11, 2026
Merged

fix: prevent navigation and focus issues by checking route state#922
PartyDonut merged 1 commit intoDonutWare:developfrom
schembriaiden:fix/escape-close-modal

Conversation

@schembriaiden
Copy link
Copy Markdown
Contributor

@schembriaiden schembriaiden commented Apr 7, 2026

Pull Request Description

This pull request improves the handling of focus and exit actions in the video player and input handler components by ensuring that certain actions only occur when the current route is active. This helps prevent unintended behavior when the widget is not the topmost route.

Route-awareness improvements:

  • In both _TvPlayerControlsState (tv_player_controls.dart) and _DesktopControlsState (video_player_controls.dart), the exit hotkey now checks if the current route is active before closing the player, preventing accidental closure when not on the main route.
  • In _InputHandlerState (input_handler.dart), autofocus is now only triggered if the current route is active, avoiding unwanted focus changes when the widget is not visible.

As an example, when going into one of the sub-menus while in the player, such as Subtitles or Audio, you can press Escape to go back to the player without actually exiting the player. If you are in the player itself it will then stop the player.

Issue Being Fixed

Resolves #694

Screenshots / Recordings

Tested On

  • Android
  • Android TV
  • iOS
  • Linux
  • Windows
  • macOS
  • Web

Checklist

  • If a new package was added, did you ensure it works for all supported platforms? Is the package well maintained
  • Check that any changes are related to the issue at hand.

@schembriaiden schembriaiden force-pushed the fix/escape-close-modal branch from 937db2a to 942fc52 Compare April 7, 2026 21:14
@schembriaiden
Copy link
Copy Markdown
Contributor Author

schembriaiden commented Apr 10, 2026

@PartyDonut seeing this issue #930, do you think this would also make sense as a change in the player?

If the player is fullscreen, when the user first hits Escape it takes them out of fullscreen, and if they hit Escape again it stops the player.

Currently when a player hits Escape once while fullscreen it goes out of fullscreen and stops the player, so I thought adding the above change would help.

@PartyDonut
Copy link
Copy Markdown
Collaborator

PartyDonut commented Apr 11, 2026

@PartyDonut seeing this issue #930, do you think this would also make sense as a change in the player?

If the player is fullscreen, when the user first hits Escape it takes them out of fullscreen, and if they hit Escape again it stops the player.

This is the other way around right? Or at least for me it closes the player first and hitting escape again exits full-screen (on macOS). This might actually depend on this system in which case the default "escape" shortcut should probably be changed?

How it works now from the PR is probably better close the player first and then let the system take over exiting full-screen.

@PartyDonut PartyDonut added the bug Something isn't working label Apr 11, 2026
@PartyDonut PartyDonut merged commit df42d9c into DonutWare:develop Apr 11, 2026
1 check passed
@github-project-automation github-project-automation bot moved this to Done in Fladder Apr 11, 2026
@schembriaiden schembriaiden deleted the fix/escape-close-modal branch April 11, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 Hitting escape when any of the player menus(subtitles,audios, transcoding etc.) is open causes the player to crash

2 participants