Skip to content

Extract fullscreen keyboard lock codes#333

Open
zortos293 wants to merge 1 commit intomainfrom
zortos/fix-regional-keyboard-input
Open

Extract fullscreen keyboard lock codes#333
zortos293 wants to merge 1 commit intomainfrom
zortos/fix-regional-keyboard-input

Conversation

@zortos293
Copy link
Copy Markdown
Collaborator

Summary

  • Centralize the fullscreen keyboard lock key list in a shared module
  • Reuse the shared list in the renderer app and WebRTC client
  • Expand test coverage to include the keyboard lock module

Testing

  • Not run (not requested)

@zortos293
Copy link
Copy Markdown
Collaborator Author

@capyai review this

@zortos293 zortos293 marked this pull request as ready for review April 17, 2026 10:52
@zortos293 zortos293 linked an issue Apr 17, 2026 that may be closed by this pull request
@Kief5555 Kief5555 requested a review from Copilot April 20, 2026 16:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Centralizes the fullscreen navigator.keyboard.lock() key-code list into a single renderer module so both the UI (App.tsx) and the WebRTC client use the same set, and adds a unit test for that module.

Changes:

  • Added FULLSCREEN_KEYBOARD_LOCK_CODES in a new keyboardLock.ts module.
  • Updated App.tsx and gfn/webrtcClient.ts to reuse the shared keyboard lock list.
  • Expanded the test script to run all gfn/*.test.ts tests and added keyboardLock.test.ts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
opennow-stable/src/renderer/src/gfn/webrtcClient.ts Replaces inline keyboard lock code list with imported shared constant.
opennow-stable/src/renderer/src/gfn/keyboardLock.ts Introduces the centralized fullscreen keyboard lock codes list.
opennow-stable/src/renderer/src/gfn/keyboardLock.test.ts Adds unit coverage for the centralized keyboard lock list.
opennow-stable/src/renderer/src/App.tsx Replaces inline keyboard lock code list with imported shared constant.
opennow-stable/package.json Updates test script to run all gfn test files.

"dist:signed": "npm run build && electron-builder",
"typecheck": "tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.json",
"test": "tsx --test src/renderer/src/gfn/inputProtocol.test.ts"
"test": "tsx --test src/renderer/src/gfn/*.test.ts"
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The *.test.ts glob in the test script relies on shell glob expansion; this typically won’t expand on Windows (cmd.exe), which can cause tsx --test to receive the literal pattern and run zero tests. Consider using an explicit file list or a cross-platform glob mechanism (e.g., a small Node script that resolves test files) to ensure npm test works on all supported platforms.

Suggested change
"test": "tsx --test src/renderer/src/gfn/*.test.ts"
"test": "node --input-type=module -e \"import { readdirSync, statSync } from 'node:fs'; import path from 'node:path'; import { spawnSync } from 'node:child_process'; const root = 'src/renderer/src/gfn'; const walk = (dir) => readdirSync(dir).flatMap((entry) => { const fullPath = path.join(dir, entry); return statSync(fullPath).isDirectory() ? walk(fullPath) : fullPath.endsWith('.test.ts') ? [fullPath] : []; }); const files = walk(root); if (files.length === 0) { console.error('No test files found in ' + root); process.exit(1); } const result = spawnSync(process.execPath, ['./node_modules/tsx/dist/cli.mjs', '--test', ...files], { stdio: 'inherit' }); process.exit(result.status ?? 1);\""

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,12 @@
export const FULLSCREEN_KEYBOARD_LOCK_CODES: readonly string[] = [
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as const is redundant here because the explicit : readonly string[] annotation widens the array type and discards the literal tuple typing. Consider removing the as const or switching to as const satisfies readonly string[] (or no explicit annotation) so the declaration is unambiguous.

Copilot uses AI. Check for mistakes.
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.

lower case N and capital T still not working

2 participants