From b67faca60b21b0cf74d5c967f0f8d215ad601e93 Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Tue, 28 Jul 2026 20:30:49 +0530 Subject: refactor(domains): strip comment noise Removes module banners, step markers, and comments restating the code. Keeps one-line notes for safeJs's trust boundary, the select-match null sentinels, the TUI width clamp, the single-window tab rule, the input synthesis quirks (char events, keyCode, mousemove, focus, compositor), the stale AX value, ignored-wrapper recursion, and isolated-tab routing. Co-Authored-By: Claude Opus 5 (1M context) --- src/domains/keyboard.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/domains/keyboard.ts') diff --git a/src/domains/keyboard.ts b/src/domains/keyboard.ts index 4ee8243..f0f1a6d 100644 --- a/src/domains/keyboard.ts +++ b/src/domains/keyboard.ts @@ -97,9 +97,7 @@ export const pressKeyTool = defineBrowserTool({ }; const down = await cdpCall(client, "Input.dispatchKeyEvent", downParams); if (!down.success) return down; - // For a printable character with no command modifier (Ctrl/Meta/Alt = 1|2|4), - // emit a `char` event so the page receives keypress/textInput and the - // character is actually inserted. Shift (8) is allowed (capitals/symbols). + // A printable character needs a `char` event for the page to receive keypress/textInput and actually insert it; Shift (8) still counts as printable. const hasCommandModifier = (modifiers & (1 | 2 | 4)) !== 0; if (isChar && !hasCommandModifier) { const charEv = await cdpCall(client, "Input.dispatchKeyEvent", { type: "char", text: k, key: k }); @@ -143,12 +141,8 @@ export const dispatchKeyTool = defineBrowserTool({ async handler(args, { client }): Promise> { const eventType = args.eventType ?? "keydown"; const target = args.ref ?? args.selector ?? ""; - // Legacy handlers commonly branch on e.keyCode/e.which (e.g. === 13 for - // Enter) rather than e.key, so populate both. virtualKeyCode maps named - // keys and single chars; 0 for anything unknown. + // Legacy handlers branch on e.keyCode/e.which rather than e.key, so populate both. const code = virtualKeyCode(args.key); - // Ref path: dispatch on the single resolved node. Selector path: dispatch on - // all matches (preserves the original multi-match behavior). if (args.ref !== undefined) { const objectId = await resolveRefToObjectId(client, args.ref); if (!objectId.success) return objectId; -- cgit v1.2.3