chat: enable native autocorrect on web mobile chat inputs#314842
Draft
chat: enable native autocorrect on web mobile chat inputs#314842
Conversation
Mobile soft keyboards rely on the input element's autocorrect, autocapitalize and spellcheck attributes to decide whether to run auto-correction and auto-capitalization while typing. Monaco hardcoded all three to off on both the textarea and native edit-context input elements, which meant the chat inputs in vscode.dev/agents on a phone got no auto-correction at all. - Add an opt-in editor option, inputAids, that flips autocorrect, autocapitalize and spellcheck on the input element. autocomplete (form autofill) is left off. Default is false; the option has no settings schema and is internal-only for now. - Wire it through both edit context implementations (textAreaEditContext, nativeEditContext) so it stays correct across configuration changes and across the editor.editContext flip. - Enable inputAids = isWeb && isMobile in the two chat inputs: workbench ChatInputPart and the agents-window NewChatInputWidget. Desktop, web desktop, and Electron keep the existing behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Enables native mobile keyboard assistance (autocorrect/autocapitalize/spellcheck) for chat inputs on web mobile by introducing an internal editor option that controls these attributes on Monaco’s input element across both textarea and native EditContext implementations.
Changes:
- Added a new internal editor option
inputAids(defaultfalse) to toggle native input aid attributes on the editor input element. - Applied
inputAidsin both textarea- and native-EditContext input implementations, including updating on configuration changes. - Enabled
inputAidsonly for web mobile chat inputs in the workbench chat input and the Agents window new-chat input.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Enables inputAids for workbench chat input on web mobile only. |
| src/vs/sessions/contrib/chat/browser/newChatInput.ts | Enables inputAids for Agents window chat input on web mobile only. |
| src/vs/editor/common/config/editorOptions.ts | Introduces internal editor option inputAids and registers it (no settings schema). |
| src/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.ts | Centralizes writing autocorrect/autocapitalize/spellcheck on the textarea based on inputAids (constructor + config changes). |
| src/vs/editor/browser/controller/editContext/native/nativeEditContext.ts | Writes autocorrect/autocapitalize/spellcheck on the native EditContext host element based on inputAids (constructor + config changes). |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mobile soft keyboards rely on the input element's
autocorrect,autocapitalizeandspellcheckattributes to decide whether to run auto-correction and auto-capitalization while typing. Monaco hardcoded all three tooffon both the<textarea>and nativeEditContextinput elements, which meant the chat inputs in vscode.dev/agents on a phone got no auto-correction at all — typing prose on a phone there was unforgiving.Chat inputs are prose, not code, so we want the mobile keyboard's full assistance there.
Changes
New internal editor option
inputAids(src/vs/editor/common/config/editorOptions.ts)false, no settings schema — internal-only for now.true, flipsautocorrect=on,autocapitalize=on,spellcheck=trueon the editor's input element. Theautocompleteattribute (form autofill) is intentionally left atoff.Wired through both edit-context implementations
src/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.tssrc/vs/editor/browser/controller/editContext/native/nativeEditContext.tsonConfigurationChanged, so the value stays correct across theeditor.editContextflip and any other config changes.Enabled for web mobile only in the two chat input call sites:
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts(workbenchChatInputPart)src/vs/sessions/contrib/chat/browser/newChatInput.ts(agents-windowNewChatInputWidget)inputAids: isWeb && isMobile. Other Monaco editors (find widget, rename input, etc.) are unaffected.Resulting matrix
ChatInputPart)NewChatInputWidget)Testing
npm run compile-check-ts-native— cleannpm run valid-layers-check— cleaneditor.editContext: trueandfalsepaths should be exercised.Why the editor-option approach
We considered a DOM-mutation alternative (querying
.inputarea/.native-edit-contextafter editor creation and flipping the attributes from the chat input itself). The editor-option route was chosen because:editor.editContextsetting flip, which recreates the input element;The option is intentionally undocumented in user settings; if a future use case warrants it, we can add a schema description.