Skip to content

fix(computer): type into Windows text boxes without bringing the window forward - #42165

Merged
AmoabaKelvin merged 2 commits into
mainfrom
fix/windows-background-text-entry
Nov 14, 2026
Merged

AmoabaKelvin merged 2 commits into
mainfrom
fix/windows-background-text-entry

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

On Windows, an agent could only type into an app by bringing that app's window to the front and taking the keyboard. Now it can type into a text box in an app that stays behind your window. If typing really needs the window in front, Orca refuses without sending anything and tells the agent to ask you first.

Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​400 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​385
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​309 $\color{#cf222e}{\Huge{\mathbf{−}}}$​51 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​258

What Changed

All of this is in the Windows provider, native/computer-use-windows/runtime.ps1.

  • type-text --element-index works on Windows. capabilities now reports actions.typeTextElement: true.
    • Native text boxes (user32 Edit, RichEdit, and their WinForms versions): the text replaces the field's selection through EM_REPLACESEL. Before sending, Orca checks that the field's window still belongs to the target process. Afterwards it reads the text back with WM_GETTEXT and compares it with what the EM_GETSEL selection should give. The result is verified elementText, text_mismatch, or an error when the field did not change.
    • Other UI Automation text fields (WPF, UWP): Orca reads the current value, inserts the text at the TextPattern selection, writes the result through ValuePattern, reads it back, and puts the caret after the inserted text.
    • Refused with value_not_settable: disabled fields, read-only fields and elements that aren't text fields.
    • Fields with no background route (Chromium web content, which applies a value write as replaced inner text): refused with background_unavailable. With --restore-window, Orca focuses the field and types.
  • Keyboard verbs on a background window refuse before sending anything. This covers type-text without an index, press-key, hotkey and paste-text. They used to answer window_not_focused … retry with --restore-window. They now return background_unavailable, point at type-text --element-index / set-value (or click --element-index for a button), and end with "Ask the user before retrying with --restore-window." The bridge maps the new prefix to that error code.
  • Typing in the foreground (--restore-window) uses one SendInput batch of KEYEVENTF_UNICODE characters. Before, it used SendKeys, or for non-ASCII text a WM_CHAR posted to the top-level window, which never reaches the focused child control. Newline and Tab still go out as key presses. The key, hotkey and text helpers no longer call SetForegroundWindow again: the window was raised once at the start of the request. Instead they check focus right before sending, so text never lands in a window the user just switched to.
  • get-app-state shows multiline edit text again (Notepad's document, WinForms multiline boxes). fix(computer): initialize Windows control proxies #36383 loaded the managed client-side proxies, which give a multiline edit no ValuePattern, so its text dropped out of the tree. That is why the four Notepad e2e tests had been failing nightly since Oct 31. Orca now reads that text with WM_GETTEXT.
  • The skill guide, the CLI docs page and the benchmark README say Windows supports element typing and describe the keyboard refusal.

Why

The fleet's foreground policy (copied from agent-desktop #660/#667) says that without --restore-window, Orca never takes the foreground. When the only route needs the foreground, Orca refuses before sending anything, and the refusal tells the agent to ask the user. Text entry was the most common way agents took the user's screen on Windows: every keyboard verb either needed a raise or said to retry with one.

  • Why EM_REPLACESEL first: user32 marshals its string across processes, and the edit needs neither focus nor activation. Windows CI measured that on a WinForms text box in a background window, it did not activate the window, and the readback verified.
  • Why Return isn't sent as a default-button press: the brief suggested pressing the default button in the background. It isn't in this PR. Windows clears a thread's keyboard focus when its window deactivates, so there is no focused control left to tell us what Return would do. Guessing the default button would sometimes press OK where Return meant a newline. The refusal points the agent at click --element-index for the button instead.

Measured on Windows CI with a background WinForms window: managed UI Automation Invoke, Toggle, ValuePattern.SetValue, SelectionItem.Select and ScrollPattern all activate the window. action.delivery already reports this honestly as foreground. A follow-up PR adds a COM CUIAutomation8 client with AutoSetFocus=false, LegacyIAccessible rungs, and the combo and list window-message routes, so those patterns stay in the background too.

Linked Issue

No GitHub issue. This is part of the computer-use background-input work, focus audit §2 and agent-desktop research items 5 and 6.

Visual Proof

N/A. Orca's own UI doesn't change. The behaviour change is in what happens to another app's window, so it was verified with the dispatched Windows e2e run below, which records whether the target window was activated.

Testing

  • PowerShell unit tests, new file native/computer-use-windows/runtime-text-entry.test.ps1. CI runs it in native-smoke (Windows) through verify:computer-native. Locally I ran it, and the existing pointer test, with a portable pwsh. The tests check that:

    • each background keyboard verb refuses and sends nothing;
    • an EM_REPLACESEL insertion keeps CRLF line breaks, verifies, and reports delivery: background;
    • a replacement with identical text verifies;
    • a field that ignores the insertion is an error;
    • a disabled field, a recycled handle owned by another process, and an element with no text route are each refused with nothing sent;
    • foreground typing goes through SendInput Unicode.
  • Windows e2e, dispatched: computer-e2e run 43514935949 (this code plus a scratch measurement file).

    • The new computer-use Windows Forms text entry tests passed: Unicode typed into a background single-line box, a line break kept in a multiline box, the window's activation count unchanged, verified elementText, and press-key Return refused with background_unavailable while the fixture stayed untouched.
    • The four Notepad tests that had been failing nightly passed.
    • A rerun on the final head is computer-e2e run 43519739632.
  • Not tested: live typing into WPF, UWP and Chromium fields on a real desktop. No Windows machine here.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Risk

Riskiest part: agents that relied on the old flow. That flow was: type-text fails with window_not_focused, the agent adds --restore-window, and retries. Those agents now get background_unavailable with a pointer to type-text --element-index. That is the intended policy change, and the error-recovery wording is being updated in a sibling PR.

Other risks:

  • An edit that rewrites its own text when it changes (a formatting box) reads back as text_mismatch instead of verified. It is never reported as a false success.
  • The WM_GETTEXT tree read adds one cross-process message for each empty edit-class element in get-app-state, and two when the field holds text.

Scope: Windows only. macOS and Linux providers, older clients and SSH are untouched: older hosts still report typeTextElement: false, and the CLI keeps refusing element typing for them. To back it out, revert the PR.

Level: Medium

AI Disclosure

Review

Two review-loop rounds, each with Codex and a Claude subagent. Fixed:

  • disabled edits accepted the write;
  • read-only fields and fields that aren't text fields were refused as background_unavailable instead of not settable;
  • the owner check ran after the first messages to the field;
  • a replacement with identical text reported an error;
  • the WPF caret was not put back after a value write, then was put back by the wrong unit;
  • Chromium contenteditable was rewritten through ValuePattern;
  • Tab is sent as a key again;
  • the key and hotkey helpers now re-check focus right before sending;
  • the docs and README said Windows had no element typing.

Not changed: a focus loss in the moment between the check and the send still returns window_not_focused (rated P3).

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

The design follows vercel-labs/agent-desktop (Apache-2.0): the owner check before messaging a native window (pr-662) and the foreground refusal policy (pr-660/#667). No code was copied.

Notes

  • Cross-platform: Windows only.
  • Remote and SSH: the provider runs on the host, so this works the same on a paired host.
  • Mobile: no change.
  • Security: messages go only to windows whose owner is the target process. Password fields go through EM_REPLACESEL without any readback, and the ValuePattern route refuses them.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The Windows runtime now supports indexed text entry through native edit and UI Automation paths. It uses synthetic typing only under specified fallback conditions. Other keyboard operations check that the target window still has focus. PowerShell and end-to-end tests cover text entry and background-input refusals. Documentation and benchmark guidance describe indexed text entry on Windows.

Merge Risk: Low · up to c4fe3

Windows background text entry works for common fields. A few edge cases remain, such as read-only rich text controls, caret handling for unusual text, and some documentation and test gaps. None is likely to cause serious harm, so the change is mergeable with follow-ups.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Windows text boxes can be typed into without bringing the window forward. The changeset adds background element text entry on Windows (EM_REPLACESEL, ValuePattern) and…
Description check Passed The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof (N/A with reason), Testing with platforms and CI runs, Risk with level and backout, …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Windows text boxes can be typed into without bringing the window forward. The changeset adds background element text entry on Windows (EM_REPLACESEL, ValuePattern) and refuses keyboard input when the window is in the background. The title follows the conventional commit format and matches the primary behavior change.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue, Visual Proof (N/A with reason), Testing with platforms and CI runs, Risk with level and backout, AI Disclosure, Review, upstream boundary, Notes, and Checklist. It explains before and after behavior and the mechanism. Gaps: the Linked Issue section says no GitHub issue exists, but the template says outside contributors must link one, and the author does not say whether they are an outside contributor. The AI Disclosure section is empty, and the pnpm checklist item is unchecked. The description also names the Windows e2e run and a rerun, but these need CI confirmation.

Resolution

Confirm whether the author is an outside contributor. If so, link a real issue under Linked Issue, since the template requires one. Fill in the AI Disclosure section or confirm it does not apply. Check the pnpm lint, typecheck, test, and build item or state that CI will cover it.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e9aadb4b-5926-4d2c-a53d-40bfbf5bed48
Commits

Reviewing files that changed from the base of the PR and between 39ff7be and 1442b78.

Files selected for processing: 11

  • config/benchmarks/computer-use/README.md
  • config/scripts/runtime-verification/desktop-transport/verify-computer-native.mjs
  • docs/site/content/docs/cli/computer-use.mdx
  • native/computer-use-windows/runtime-text-entry.test.ps1
  • native/computer-use-windows/runtime.ps1
  • skill-guides/orca-computer-use.md
  • src/cli/skills/bundled-skill-guides.ts
  • src/main/computer/desktop-script/desktop-script-provider-bridge.ts
  • tests/e2e/computer-windows-background.e2e.ts
  • tests/e2e/helpers/windows-semantic-controls-fixture.ts
  • tests/e2e/helpers/windows-semantic-controls-fixture.winforms.ps1

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Comment thread skill-guides/orca-computer-use.md Resolved
@AmoabaKelvin
AmoabaKelvin force-pushed the fix/windows-background-text-entry branch 2 times, most recently from 583fd4e to cc643f1 Compare November 14, 2026 00:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Nitpick comments: 1

native/computer-use-windows/runtime-text-entry.test.ps1: 1

159-159: Trivial · Maintainability & Code Quality · Quick win

Add a focus-loss case for the final typing guard.

The foreground Unicode case keeps Foreground at 101 for the whole run. Removing Assert-OrcaStillFocused from Send-OrcaText would not change its result, so the case would still pass. No other test in this file asserts window_not_focused for typed text.

Add a case that changes Foreground to a different window after Assert-OrcaKeyboardFocus succeeds and before Send-OrcaText runs. Make the change with the call-triggered pattern used in runtime-pointer.test.ps1. Then assert that the outcome message starts with window_not_focused and that no keys: call is recorded.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bdc8a007-e9b9-4e4b-a90b-79e86bc20adc
Commits

Reviewing files that changed from the base of the PR and between 1442b78 and 583fd4e.

Files selected for processing: 5

  • docs/site/content/docs/cli/computer-use.mdx
  • native/computer-use-windows/runtime-text-entry.test.ps1
  • native/computer-use-windows/runtime.ps1
  • skill-guides/orca-computer-use.md
  • src/cli/skills/bundled-skill-guides.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Comment thread native/computer-use-windows/runtime.ps1 Resolved
Comment thread native/computer-use-windows/runtime.ps1 Resolved
Comment thread native/computer-use-windows/runtime.ps1 Resolved
Comment thread skill-guides/orca-computer-use.md Resolved
Adds type-text --element-index on Windows through EM_REPLACESEL for user32,
RichEdit and WinForms edits (owner-checked, read back with WM_GETTEXT), or a
ValuePattern write merged with the TextPattern selection. Keyboard verbs on a
background window now refuse with background_unavailable before sending
anything and point at type-text --element-index. Foreground typing uses one
SendInput KEYEVENTF_UNICODE batch instead of WM_CHAR posted to the top-level
window, and get-app-state shows multiline edit text again.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

Minor · Use the advertised RichEdit length before classifying an unchanged readback. · runtime.ps1:837

native/computer-use-windows/runtime.ps1:837
Minor · Functional Correctness · Quick win

Use the advertised RichEdit length before classifying an unchanged readback.

For RichEdit fields, GetEditText reads with WM_GETTEXT, which Microsoft documents as returning at most 64K characters. A document longer than that returns the same prefix before and after an insertion at its end. The insertion then reads as unchanged and throws text_insertion_unconfirmed, although the text was inserted. The retry guidance can then duplicate the text.

Have GetEditText also return the WM_GETTEXTLENGTH value it already reads. The insertion path should compare that advertised length with the length actually returned. If they differ, it should return the unverified state with a truncation reason, not throw. Add a RichEdit test with more than 65,535 characters so the path is exercised.

Minor · Re-read the field value before the whole-value write. · runtime.ps1:904

native/computer-use-windows/runtime.ps1:904
Minor · Data Integrity & Integration · Quick win

Re-read the field value before the whole-value write.

Invoke-OrcaValueTextInsertion builds $next from the value and selection read at lines 899–900. It then calls SetValue($next), which replaces the entire field value. If the user edits the field after the read, SetValue overwrites that edit. The readback then compares against $next, so the call still reports verified.

The inspected UI Automation provider exposes only whole-value SetValue. Insertion at the caret cannot be delegated to the provider on this path. A re-read immediately before the write narrows the window. It does not make the sequence atomic. Fail the write when the value changed, so the caller can read the field again.

Suggested fix

     $next = $current.Substring(0, $selection[0]) + $Text + $current.Substring($selection[1])
+    # Why: a re-read narrows the window before the write; it cannot make read-then-write atomic.
+    if ([string]$pattern.Current.Value -cne $current) {
+        throw "element $Index text changed while the insertion was prepared; read it again and retry"
+    }
     $pattern.SetValue($next)
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1970a1dc-755d-48d5-811e-1f7940e94c10
Commits

Reviewing files that changed from the base of the PR and between 583fd4e and cc643f1.

Files selected for processing: 4

  • docs/site/content/docs/cli/computer-use.mdx
  • native/computer-use-windows/runtime.ps1
  • skill-guides/orca-computer-use.md
  • src/cli/skills/bundled-skill-guides.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

`hotkey` and `press-key` refuse shortcuts that quit or close the app, log out, lock the screen, force-quit or end the session, such as `Cmd+Q`, `Shift+Cmd+Q`, `Ctrl+Cmd+Q` and `Option+Cmd+Esc` on macOS, `Alt+F4` and `Win+L` on Windows, and `Ctrl+Q`, `Alt+F4`, `Super+L` and `Ctrl+Alt+Delete` on Linux. The error code is `system_shortcut_blocked`. Pass `--allow-system-shortcut` to send one anyway.

`type-text --element-index <i>` inserts the text at that field's caret without focusing it or bringing its window forward. It works on macOS and Linux; on Windows, click the field, confirm it is the focused text receiver, and run `type-text` without the index.
`type-text --element-index <i>` inserts the text at that field's caret without focusing it or bringing its window forward. It works on macOS, Linux and Windows.

@coderabbitai coderabbitai Bot Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Document the append fallback for ValuePattern fields with no readable caret.

The sentence "inserts the text at that field's caret" is not accurate for Windows fields that expose ValuePattern without a readable selection. In that case the runtime appends the text to the end of the value (runtime.ps1:901-904). Text does not land at an arbitrary position, but the documented caret behavior does not hold. Describe the fallback for the Windows section, or qualify the sentence in the general paragraph.

Suggested fix

--- "a/docs/site/content/docs/cli/computer-use.mdx"
+++ "b/docs/site/content/docs/cli/computer-use.mdx"
@@ -90,7 +90,7 @@
 
 `hotkey` and `press-key` refuse shortcuts that quit or close the app, log out, lock the screen, force-quit or end the session, such as `Cmd+Q`, `Shift+Cmd+Q`, `Ctrl+Cmd+Q` and `Option+Cmd+Esc` on macOS, `Alt+F4` and `Win+L` on Windows, and `Ctrl+Q`, `Alt+F4`, `Super+L` and `Ctrl+Alt+Delete` on Linux. The error code is `system_shortcut_blocked`. Pass `--allow-system-shortcut` to send one anyway.
 
-`type-text --element-index <i>` inserts the text at that field's caret without focusing it or bringing its window forward. It works on macOS, Linux and Windows.
+`type-text --element-index <i>` inserts the text at that field's caret without focusing it or bringing its window forward. It works on macOS, Linux and Windows. On Windows, a text box that exposes no readable caret position receives the text at the end of its value.
 
 On macOS, actions run in the background: the target app isn't brought forward, your frontmost app and key window stay put, and the pointer doesn't move, so you can keep working while an agent drives another window. Each action result reports `action.delivery` (`background` or `foreground`). Pass `--restore-window` only when an app ignores background input, such as drags in Chromium or Electron apps or games; it brings the app forward and uses the real pointer and keyboard. The bundled skill tells agents never to add it on their own: they ask you first, and error messages say the same. Popup menus and web `<select>` controls are set with `set-value` instead of a click. On Linux, element clicks through accessibility actions, `set-value`, `type-text --element-index` and secondary actions run in the background; actions that need the real pointer or the focused window are refused unless you pass `--restore-window`. On Wayland they are refused even with it, because synthetic input never reaches native windows. On Windows, element clicks, `set-value` (including sliders), scrolls and secondary actions (`Invoke`, `Toggle`, `Select`, `Expand`, `Collapse`, `ScrollToVisible`) go through UI Automation when the control supports them, without moving the pointer or sending keys. `type-text --element-index` also works there for text boxes. Some apps still bring their own window forward when driven this way (WPF apps do for most of these), so `action.delivery` reports `foreground` whenever the target window came forward. Actions that need the real mouse, such as coordinate clicks, right-clicks and drags, are refused unless you pass `--restore-window`; then only the target window comes forward and the pointer goes back where it was. Keyboard input (`type-text` without an index, `press-key`, `hotkey`, `paste-text`) is refused the same way while the window isn't in front.
 
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
`type-text --element-index <i>` inserts the text at that field's caret without focusing it or bringing its window forward. It works on macOS, Linux and Windows.
`type-text --element-index <i>` inserts the text at that field's caret without focusing it or bringing its window forward. It works on macOS, Linux and Windows. On Windows, a text box that exposes no readable caret position receives the text at the end of its value.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The follow-up PR will document the append fallback for fields with no readable caret.

@AmoabaKelvin
AmoabaKelvin force-pushed the fix/windows-background-text-entry branch from cc643f1 to c4fe30b Compare November 14, 2026 01:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Nitpick comments: 1

native/computer-use-windows/runtime-text-entry.test.ps1: 1

163-168: Trivial · Maintainability & Code Quality · Quick win

Test focus loss before the final send guard.

The foreground handle stays at 101 throughout this test. The test would still pass if the final focus check were removed.

Add a controlled focus change after the initial operation guard and before the final send guard. Assert that the operation reports a focus refusal and records no keys: call. Keep the existing Unicode success case.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e533fff-23d8-4278-a61a-be00f04ff52f
Commits

Reviewing files that changed from the base of the PR and between cc643f1 and c4fe30b.

Files selected for processing: 5

  • docs/site/content/docs/cli/computer-use.mdx
  • native/computer-use-windows/runtime-text-entry.test.ps1
  • native/computer-use-windows/runtime.ps1
  • skill-guides/orca-computer-use.md
  • src/cli/skills/bundled-skill-guides.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

}
$action = Invoke-OrcaValueTextInsertion $Element $index $Text
if ($null -ne $action) { return $action }
if (-not [bool]$Operation.restoreWindow) {

@coderabbitai coderabbitai Bot Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Reject read-only TextPattern targets before the keyboard fallback.

A read-only WPF 8 RichTextBox exposes ControlType.Document and TextPattern, but no ValuePattern. It passes the text-control check, then Invoke-OrcaValueTextInsertion returns $null before checking read-only state. With restoreWindow = $true, this path focuses the read-only control, sends keys, and returns a synthetic action instead of refusing. The WPF provider confirms this pattern combination. (raw.githubusercontent.com)

Check TextPattern.IsReadOnlyAttribute before this fallback. WPF exposes the control's read-only state through that attribute. (raw.githubusercontent.com)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. The follow-up PR (Windows native controls) will refuse a read-only TextPattern target before the keyboard fallback.

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.

1 participant