Skip to content

Commit 897f272

Browse files
committed
Prevent automatic page scrolling when focusing the prompt field input
- when focusing on changed focus_key do not scroll the view onto the element
1 parent e6f5e66 commit 897f272

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • packages/ui/src/components/editor/panel/prompts/PromptField/hooks

‎packages/ui/src/components/editor/panel/prompts/PromptField/hooks/use-handlers.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const use_handlers = (
127127
if (params.input_ref.current && !props.missing_configuration) {
128128
requestAnimationFrame(() => {
129129
if (!params.input_ref.current) return
130-
params.input_ref.current.focus()
130+
params.input_ref.current.focus({ preventScroll: true })
131131
const selection = window.getSelection()
132132
if (selection) {
133133
const range = document.createRange()
@@ -144,7 +144,7 @@ export const use_handlers = (
144144
if (params.input_ref.current && !props.missing_configuration) {
145145
requestAnimationFrame(() => {
146146
if (!params.input_ref.current) return
147-
params.input_ref.current.focus()
147+
params.input_ref.current.focus({ preventScroll: true })
148148
const selection = window.getSelection()
149149
if (selection) {
150150
const range = document.createRange()

0 commit comments

Comments
 (0)