Skip to content

Reset textarea scroll and caret after loading response schema example#2

Merged
sohchatt merged 1 commit into
mainfrom
copilot/fix-cursor-focus-response-schema
May 21, 2026
Merged

Reset textarea scroll and caret after loading response schema example#2
sohchatt merged 1 commit into
mainfrom
copilot/fix-cursor-focus-response-schema

Conversation

Copy link
Copy Markdown

Copilot AI commented May 21, 2026

After clicking "load an example" in the Response constraint schema field, the textarea was populated but left scrolled to the end, obscuring the start of the JSON from the user.

built-in-ai/static/prompt-api.js

  • After setting responseSchemaEl.value, reset focus, caret position, and scroll so the textarea opens at the top of the JSON:
responseSchemaEl.focus();
responseSchemaEl.setSelectionRange(0, 0);
responseSchemaEl.scrollTop = 0;
responseSchemaEl.scrollLeft = 0;

@sohchatt sohchatt marked this pull request as ready for review May 21, 2026 18:08
@sohchatt sohchatt merged commit e25925b into main May 21, 2026
2 checks passed
@sohchatt sohchatt deleted the copilot/fix-cursor-focus-response-schema branch May 21, 2026 18:10
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.

2 participants