FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Fix/player focus bug

Open Razen04 opened this issue 9 months ago • 0 comments

Fix Player Focus and Arrow Key Scroll Behavior

Pull Request Type

  • [x] Bugfix
  • [ ] Feature Implementation
  • [ ] Documentation
  • [ ] Other

Related issue

closes #931

Description

This PR fixes the behavior of the player focus detection and scroll handling using the arrow keys. The following changes were made:

  • Added click event listener to detect whether the player is in focus or not by checking the click position inside the player.
  • Prevented page scrolling when the player is focused and the arrow keys are pressed.
  • Added keydown event handling to stop the default action and propagation of the arrow keys for smooth scrolling only when the player is not focused.
  • Improved the responsiveness to user interactions by checking focus state and controlling scroll and player interactions.

Screenshots

N/A

Testing

  • Tested by clicking inside and outside the player to see if playerFocussed correctly toggles.
  • Verified that when the player is focused, arrow keys no longer scroll the page.
  • Checked that when the player is not focused, arrow keys control the page scrolling without affecting the player.

Desktop

  • OS: ZorinOS
  • OS Version: 17.2
  • FreeTube version: 0.23.2

Additional context

N/A

Razen04 avatar Mar 15 '25 16:03 Razen04