Skip to content

fix(web): reset shortcut modifiers after dictation paste - #11

Merged
Zain-Repo merged 4 commits into
mainfrom
codex/pr-8189-shortcut-state
Sep 1, 2026
Merged

fix(web): reset shortcut modifiers after dictation paste#11
Zain-Repo merged 4 commits into
mainfrom
codex/pr-8189-shortcut-state

Conversation

@Zain-Repo

Copy link
Copy Markdown
Owner

Summary

Reset shortcut modifier state after paste and prevent poisoned browser modifier flags from marking modifiers as held.

Validation

  • Shortcut modifier tests: 5 passed
  • Web typecheck passed

Upstream reference: pingdotgg/t3code#8189

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T18:23:46.017074Z 315649a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1f704c6b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/shortcutModifierState.ts Outdated
window.addEventListener("keydown", onKeyboardEvent, true);
window.addEventListener("keyup", onKeyboardEvent, true);
window.addEventListener("blur", onWindowBlur);
window.addEventListener("paste", onResetEvent, true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve held modifiers across ordinary paste

When a user performs a normal Ctrl/Cmd+V paste and continues holding Ctrl/Cmd, the capture-phase paste handler resets the state even though the modifier remains physically held. The following V keyup or number keydown cannot restore it because non-modifier events now only clear flags, so sidebar jump hints stay hidden until the user releases and presses the modifier again.

Useful? React with 👍 / 👎.

Comment on lines +96 to +97
ctrlKey: currentState.ctrlKey && event.ctrlKey,
altKey: currentState.altKey && event.altKey,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve AltGraph's reported Alt state

On Windows/Linux layouts where AltGraph is emitted as a Control keydown followed by an AltGraph event carrying both ctrlKey and altKey, AltGraph is not normalized as a modifier here. This conjunction therefore retains Ctrl but refuses to set Alt, making the state look like an exact Ctrl-only chord; downstream shouldShowThreadJumpHintsForModifiers can consequently display the default mod+1..9 jump hints while the user is typing AltGr characters.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added size:M and removed size:S labels Sep 1, 2026
@Zain-Repo

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6cb39cdf6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/shortcutModifierState.ts Outdated
Comment on lines +134 to +139
const eventWithModifierFlags = event as ClipboardEvent & Partial<ShortcutModifierFlags>;
return {
metaKey: eventWithModifierFlags.metaKey === true,
ctrlKey: eventWithModifierFlags.ctrlKey === true,
altKey: eventWithModifierFlags.altKey === true,
shiftKey: eventWithModifierFlags.shiftKey === true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid reading modifier flags from ClipboardEvent

For native Ctrl/Cmd+V, ClipboardEvent does not expose metaKey, ctrlKey, altKey, or shiftKey; this cast only suppresses the type error and does not populate those properties. Consequently, getPasteModifierFlags returns all false and shortcutModifierStateAfterPaste clears the physically held modifier, while the following V keyup cannot restore it because non-modifier events only clear state. The fresh evidence beyond the earlier comment is this follow-up's new cast-based extraction, which still leaves the normal paste path indistinguishable from an unmodified synthetic paste.

Useful? React with 👍 / 👎.

@Zain-Repo

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 315649ad6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +35 to +37
if (event.type === "keydown") {
keyboardPastePendingRef.current =
event.key.toLowerCase() === "v" && (event.metaKey || event.ctrlKey);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset modifiers after injected keyboard pastes

In the web/desktop shortcut-state hook, a dictation tool that injects Control/Meta keydown, V keydown, and paste but omits the matching keyup is classified as keyboard-initiated here. The paste handler then preserves the held modifier, leaving the thread-jump hints stuck—the failure this change is intended to fix. The paste reset must distinguish ordinary keyboard input from an injected sequence without relying only on the preceding V keydown.

AGENTS.md reference: AGENTS.md:L142-L142

Useful? React with 👍 / 👎.

Comment on lines +101 to +102
ctrlKey: event.type === "keydown",
altKey: event.type === "keydown",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Preserve independently held modifiers on AltGraph release

When a user keeps a separate Control or Alt key held while releasing AltGraph, these assignments unconditionally clear both flags. Because the new non-modifier path can only clear state, a subsequent number keydown cannot restore the still-held modifier, so jump hints remain hidden until that modifier is released and pressed again. Preserve modifier flags that remain active independently of AltGraph.

AGENTS.md reference: AGENTS.md:L142-L142

Useful? React with 👍 / 👎.

@Zain-Repo
Zain-Repo merged commit b551328 into main Sep 1, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant