Conversation
6688369 to
a9895ce
Compare
|
|
||
| interface OverlayContentProps { | ||
| children: React.ReactNode; | ||
| readonly children: React.ReactNode; |
There was a problem hiding this comment.
There's a warning in VS Code that all these properties should be declared readonly (which they should), so while I was in here I updated them. We need to do a sweep through the UI to get the rest... another PR will arrive for ONLY warning-fixes.
| initial={{ y: 20, opacity: 0, zIndex: 0 }} | ||
| animate={{ opacity: 1, y: 0 }} | ||
| exit={{ y: 43, zIndex: 0 }} | ||
| className="flex w-full items-center justify-between bg-transparent" |
There was a problem hiding this comment.
Animating the location just plain broke the layout and resulted in this button/action just being behind and invisible to the user. I couldn't get the thing centered the way I wanted, but in this form it animates into and out of visibility correctly. Also, setting the motion.div tobg-transparent helps ensure it doesn't look ugly.
| exit={{ y: 43, zIndex: 0 }} | ||
| className="flex w-full items-center justify-between bg-transparent" | ||
| initial={{ opacity: 0, zIndex: 0 }} | ||
| animate={{ opacity: 1, zIndex: 20 }} |
There was a problem hiding this comment.
Even though the div was supposed to be z-20, not animating to that destination left the div as z-index: 0 and thus invisible. Just changing this was NOT enough because it was still positioned all wonky relative to the action bar.
| className="flex w-full items-center justify-between bg-transparent" | ||
| initial={{ opacity: 0, zIndex: 0 }} | ||
| animate={{ opacity: 1, zIndex: 20 }} | ||
| exit={{ opacity: 0, zIndex: 0 }} |
There was a problem hiding this comment.
If we fade in, we have to fade out :)
| // Pointer lock and keyboard lock related | ||
| const isPointerLockPossible = window.location.protocol === "https:"; | ||
|
|
||
| const isPointerLockPossible = window.location.protocol === "https:" || window.location.hostname === "localhost"; |
There was a problem hiding this comment.
Also allowing pointer lock on "localhost" so we can test during development (this will not be an issue in deployed code)
There was a problem hiding this comment.
Good catch! I didn't realize that it could work on localhost. :-)
| ); | ||
|
|
||
| const videoKeyUpHandler = useCallback((e: KeyboardEvent) => { | ||
| if (!videoElm.current) return; |
There was a problem hiding this comment.
Cleaner to bail out so we don't need ?. below.
|
|
||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-expect-error | ||
| window.clearKeys = () => sendKeyboardEvent([], []); |
There was a problem hiding this comment.
We should not be polluting the global window namespace with this! I searched and found no references to clearKeys, so elided that line.
There was a problem hiding this comment.
We can probably use useRef or other methods to expose the API.@adamshiervani Any better idea?
There was a problem hiding this comment.
If you have a use-case, I can restore that line... but there are NO references to clearKeys anywhere else in the code-base
| mouseWheelHandler, | ||
| videoKeyUpHandler, | ||
| ], | ||
| [onVideoPlaying, videoKeyUpHandler], |
There was a problem hiding this comment.
Here and elsewhere, I deleted all the dependencies and let VSCode put back the ones really needed.
| ); | ||
|
|
||
| // Setup Absolute Mouse Events | ||
| // Setup Mouse Events |
There was a problem hiding this comment.
Merged the (nearly) duplicate handling for relative vs. absolute mouse handling.
| ); | ||
| } else { | ||
| // Reset the mouse position when the window is blurred or the document is hidden | ||
| window.addEventListener("blur", resetMousePosition, { signal }); |
There was a problem hiding this comment.
I suspect we should be doing this in both cases, but wasn't sure how to confirm that, so I left it only on absolute mouse mode.
|
Ready for you @ym @adamshiervani |
When the keyboard lock is supposed to be active (in full-screen mode), hitting the escape key (NOT long-pressing) should NOT dismiss the full-screen mode, and should send the Escape key through to the remote. - Added awaits to the browser calls that need to complete in order. - Cleaned up (mostly) duplicate code in the Absolute/Relative mouse handling - Ensure we don't overrun any existing keyboard lock or pointer lock - Release the keyboard lock when leaving full-screen - Per standards, we need to acquire the keyboard and pointer locks before entering full-screen or the user may get multiple messages about exiting. - Fixed all the missing/excess React dependencies. - Moved the pointer lock bar up so it is visible. - Somewhere along the way, the prompt to click the video when in relative-mouse-mode stopped being visible, restored it's visibility - Fixed all the "should be readonly" warnings.
a9895ce to
5d79df6
Compare
|
Looks great, looking forward to being able to using escape on my remote machines (which I do all the time by accident) |
|
|
||
| const checkNavigatorPermissions = useCallback(async (permissionName: string) => { | ||
| const name = permissionName as PermissionName; | ||
| const { state } = await navigator.permissions.query({ name }); |
There was a problem hiding this comment.
This will throw an error in browsers that do understand a permission, e.g. Firefox, causing the fullscreen button to not do anything. See: https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query
Thrown if retrieving the PermissionDescriptor information failed in some way, or the permission doesn't exist or is unsupported by the user agent.
There was a problem hiding this comment.
I don't use anything but Chrome and Edge, so thanks for finding this. I can wrap that with a check.
There was a problem hiding this comment.
I don't use anything but Chrome and Edge, so thanks for finding this. I can wrap that with a check.
Unfortunately it is still necessary to do cross-browser and cross-device testing in the world of web development today. I can recommend caniuse.com.
Per jetkvm#535 (comment) we need to handle Firefox/Mozilla browsers not having these pointer-lock or keyboard-lock permissions checks. Also might as well not throw if something goes wrong when trying to check permissions or apply for locks.
|
@IDisposable Did this really get merged into the latest update? I don't see the changes, doesn't required a long press ESC |
|
It can only do a keyboard lock if you're hitting it in HTTPS, so enable that or use app.jetkvm.com to access the JetKVM |
|
Still not working for me with Firefox on arch linux. App version 0.4.5, System version 0.2.5. Accessing jetKVM through the LAN, not cloud, with HTTPS mode enabled, using the self-signed cert option. |
|
@amatriain Keyboard locking is in experimental state and not currently suppported by Firefox, see: https://caniuse.com/mdn-api_keyboard_lock |
When the keyboard lock is supposed to be active (in full-screen mode), hitting the escape key (NOT long-pressing) should NOT dismiss the full-screen mode, and should send the Escape key through to the remote. - Added awaits to the browser calls that need to complete in order. - Cleaned up (mostly) duplicate code in the Absolute/Relative mouse handling - Ensure we don't overrun any existing keyboard lock or pointer lock - Release the keyboard lock when leaving full-screen - Per standards, we need to acquire the keyboard and pointer locks before entering full-screen or the user may get multiple messages about exiting. - Fixed all the missing/excess React dependencies. - Moved the pointer lock bar up so it is visible. - Somewhere along the way, the prompt to click the video when in relative-mouse-mode stopped being visible, restored it's visibility - Fixed all the "should be readonly" warnings.


When the keyboard lock is supposed to be active (in full-screen mode), hitting the escape key (NOT long-pressing) should NOT dismiss the full-screen mode, and should send the Escape key through to the remote.
readonlywarnings.