Skip to content

fix(navigation): reset stuck active Back/key state on window blur and document hidden - #1604

Open
swiezaczek wants to merge 1 commit into
NuvioMedia:mainfrom
swiezaczek:fix/navigation-focusengine-blur-key-reset
Open

swiezaczek wants to merge 1 commit into
NuvioMedia:mainfrom
swiezaczek:fix/navigation-focusengine-blur-key-reset

Conversation

@swiezaczek

Copy link
Copy Markdown
Contributor

Summary

Clear activeBackKeyIdentities and activeKeyDownStartedAt in FocusEngine on window blur and document visibilitychange (when document.hidden) so held keys cannot stay stuck after focus loss.

PR type

  • Translation/localization only
  • Critical bug fix
  • Approved feature/change

Affected area

  • Shared web app
  • Samsung Tizen
  • LG webOS
  • Browser development mode
  • Playback
  • Audio tracks
  • Subtitles
  • Focus / Remote navigation
  • UI / Layout
  • Resume / Watch progress
  • Continue Watching
  • Next Episode / Auto-play
  • Packaging / Build
  • Nuvio TV Installer compatibility
  • webOS Homebrew wrapper
  • Documentation
  • Other

Why

If window loses focus or the app is backgrounded while a Back or directional key is held, keyup may never fire, leaving activeBackKeyIdentities and activeKeyDownStartedAt stale.

Issue or approval

Fixes #1601

Reproduction steps

  1. Hold a Back or directional key in FocusEngine.
  2. Trigger window blur or visibilitychange (document.hidden === true) before keyup.
  3. Return to the app; activeBackKeyIdentities and activeKeyDownStartedAt still hold the stale entry.

Old behavior

FocusEngine only cleared key tracking on keyup.

New behavior

FocusEngine.init() attaches blur and visibilitychange listeners (and destroy() removes them) that clear activeBackKeyIdentities and activeKeyDownStartedAt.

Platform impact

  • Samsung Tizen: Prevents stuck Back/key state on app backgrounding.
  • LG webOS: Same shared FocusEngine lifecycle.
  • Browser development mode: Same shared FocusEngine lifecycle.
  • Installer / packaging: No impact.
  • Wrapper repositories: No impact.

UI / behavior / playback impact

  • No UI change
  • No behavior change
  • No playback change
  • UI changed only to fix a documented glitch/bug
  • Behavior changed only to fix a documented bug/regression
  • Playback changed only to fix a documented bug/regression
  • UI change has explicit maintainer approval
  • Behavior change has explicit maintainer approval
  • Playback change has explicit maintainer approval

Installer, packaging, or wrapper impact

  • No installer, packaging, or wrapper impact
  • Tizen .wgt packaging changed
  • webOS .ipk packaging changed
  • App identifiers or metadata changed
  • local.properties / environment handling changed
  • sync:tizen changed
  • sync:webos changed
  • Nuvio TV Installer compatibility changed
  • webOS Homebrew metadata support changed

Policy check

  • I have read and understood CONTRIBUTING.md.
  • This PR fits the current PR policy or has explicit maintainer approval.
  • This PR is small, focused, and limited to one issue.
  • This PR does not bundle unrelated refactors, cleanups, formatting, or drive-by changes.
  • This PR does not add dependencies, architecture changes, platform rewrites, installer rewrites, or broad refactors without approval.
  • This PR does not change UI unless it fixes a linked glitch/bug or has explicit approval.
  • This PR does not change behavior unless it fixes a linked bug/regression or has explicit approval.
  • This PR does not change playback unless it fixes a linked bug/regression or has explicit approval.
  • This PR does not change installer, packaging, app identifiers, release flow, or wrapper behavior without clear need or approval.
  • I included a linked issue, reproduction steps, and testing notes if this is a critical bug fix.
  • I listed the testing performed below.

Scope boundaries

Strictly limited to FocusEngine blur/visibilitychange key-state cleanup. package.json is left untouched to avoid conflicts with concurrent PRs.

Testing

Devices / platforms tested

  • Verified locally on Windows (Node v24.13.0) with Prettier, ESLint, and focusEngineBlurReset.test.mjs.

Commands tested

npx --no-install prettier --check js/ui/navigation/focusEngine.js js/ui/navigation/focusEngineBlurReset.test.mjs
npx --no-install eslint --quiet js/ui/navigation/focusEngine.js js/ui/navigation/focusEngineBlurReset.test.mjs
node --test js/ui/navigation/focusEngineBlurReset.test.mjs

Manual test flow

  • Ran focusEngineBlurReset.test.mjs (1/1 passing).

Screenshots / Video

Not a UI change

Logs

Not applicable

Regression risk

Low. Only clears active key tracking when the window blurs or becomes hidden.

Breaking changes

None.

Linked issues

Fixes #1601

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: FocusEngine leaves activeBackKeyIdentities/activeKeyDownStartedAt stuck on blur or hidden tab

1 participant