Fullscreen hotkey fix #5874
No reviewers
Labels
No labels
accessibility
app-parity
area: creator
area: daemon
area: design
area: devops
area: discovery
area: docs
area: installer
area: internal
area: livestream
area: performance
area: proposal
area: reposts
area: rewards
area: search
area: security
area: subscriptions
area: sync
area: ux
area: viewer
area: wallet
BEAMER
channel
comments
community PR
consider soon
core team
css
dependencies
electron
Epic
feature request
first-timers-only
good first issue
hacktoberfest
help wanted
hub-dependent
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
merge when green
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
notifications
odysee
on hold
playlists
priority: blocker
priority: high
priority: low
priority: medium
protocol dependent
recsys
redesign
regression
resilience
sdk dependent
Tom's Wishlist
trending
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbry-desktop#5874
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fullscreen-hotkey-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR Checklist
Please check all that apply to this PR using "x":
PR Type
What kind of change does this PR introduce?
Fixes
Issue Number: 5865
What is the current behavior?
CTRL+F is a commonly used hotkey for searching text on a page
LBRY currently has an "F" hotkey that will put the video player in fullscreen mode.
Unfortunately, it will activate fullscreen even if the user is trying to use the CTRL+F shortcut.
What is the new behavior?
This PR makes it so the F hotkey only works if the control key/metakey are not also being pressed.
Other information
Tested it on windows and it works.
Haven't tested on OS X, but I think it should also work, since this also checks for the metakey (⌘ Command / ⊞ Windows )
and the shortcut is Command + F on OS X
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/ctrlKey
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey
ctrl
,alt
,cmd
, etc.Alt+F
, which is the shortcut to invoke Chrome's Menu. That action still causes the video to go fullscreen.Good point. I'll add in the altkey and apply it to all single-key actions.
@infinite-persistence
I broke up the handleKeyDown function into a couple of new smaller functions:
handleShiftKeyActions() and handleSingleKeyActions().
Both handleShiftKeyActions() and handleSingleKeyActions() will exit if either alt, ctrl, or the meta key is pressed.
handleShiftKeyActions() will exit if shift is not being pressed
handleSingleKeyActions() will exit if shift is being pressed.
There is still some weird behavior with the hotkeys, but this behavior exists in the current version of lbry.
In my testing, everything else was working normally, and the issues listed still exist in current lbry. This PR fixes the ctrl+f issue and it should have fixed any other issue related to other browser hotkeys.
Actually never-mind on the 2nd issue. I was getting the speedup keys confused with the scrubbing keys (left arrow and right arrow). Everything should be fine.
Although I do wonder if there's a specific reason why the < and > hotkeys require the user to hold shift, while the rest of the hot keys don't. Is there a specific reason why the < and > hotkeys require the user to press shift?
Yeah, F11 should be for "browser full screen" instead of "player full screen". Seems like it was added to address #2514 Can't exit full-screen from embedded content with key F11 , which looks like is already fixed in the version of Electron that we are using. I think we can remove F11.
After looking into the fullscreen issue a bit more... I realized that it was actually freaking out because the fullscreen of the video player was interfering with the fullscreen hotkey in chrome.
I added e.preventDefault(), which prevents chrome's fullscreen hotkey, but the video player handles it, so it's enabled and disabled like normal.
Now the F hotkey and F11 work the same.
I also tested in both the web client and electrum and it worked in both.
Sorry, I realized that what I was doing was a bad idea. Removed the f11 hotkey instead like you said. F11 makes the browser go fullscreen, and f makes the video go fullscreen.
Is there anything else I need to do for this PR? Not sure what the contributing process is for this project.
@MaxKotlan This is great! Can you just squash your commits? Then it's good to merge.
@seanyesmunt Commits are now squashed!