Skip to content

Commit b88b323

Browse files
committed
fix(app): scroll falls behind prompt input
1 parent 6653f86 commit b88b323

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

packages/app/src/components/prompt-input.tsx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
121121
let slashPopoverRef!: HTMLDivElement
122122

123123
const mirror = { input: false }
124-
const inset = 44
124+
const inset = 52
125+
const space = `${inset}px`
125126

126127
const scrollCursorIntoView = () => {
127128
const container = scrollRef
@@ -156,8 +157,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
156157
}
157158
}
158159

159-
const queueScroll = () => {
160-
requestAnimationFrame(scrollCursorIntoView)
160+
const queueScroll = (count = 2) => {
161+
requestAnimationFrame(() => {
162+
scrollCursorIntoView()
163+
if (count > 1) queueScroll(count - 1)
164+
})
161165
}
162166

163167
const activeFileTab = createSessionTabs({
@@ -1266,7 +1270,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
12661270
editorRef?.focus()
12671271
}}
12681272
>
1269-
<div class="relative max-h-[240px] overflow-y-auto no-scrollbar" ref={(el) => (scrollRef = el)}>
1273+
<div
1274+
class="relative max-h-[240px] overflow-y-auto no-scrollbar"
1275+
ref={(el) => (scrollRef = el)}
1276+
style={{ "scroll-padding-bottom": space }}
1277+
>
12701278
<div
12711279
data-component="prompt-input"
12721280
ref={(el) => {
@@ -1288,22 +1296,34 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
12881296
onKeyDown={handleKeyDown}
12891297
classList={{
12901298
"select-text": true,
1291-
"w-full pl-3 pr-2 pt-2 pb-11 text-14-regular text-text-strong focus:outline-none whitespace-pre-wrap": true,
1299+
"w-full pl-3 pr-2 pt-2 text-14-regular text-text-strong focus:outline-none whitespace-pre-wrap": true,
12921300
"[&_[data-type=file]]:text-syntax-property": true,
12931301
"[&_[data-type=agent]]:text-syntax-type": true,
12941302
"font-mono!": store.mode === "shell",
12951303
}}
1304+
style={{ "padding-bottom": space }}
12961305
/>
12971306
<Show when={!prompt.dirty()}>
12981307
<div
1299-
class="absolute top-0 inset-x-0 pl-3 pr-2 pt-2 pb-11 text-14-regular text-text-weak pointer-events-none whitespace-nowrap truncate"
1308+
class="absolute top-0 inset-x-0 pl-3 pr-2 pt-2 text-14-regular text-text-weak pointer-events-none whitespace-nowrap truncate"
13001309
classList={{ "font-mono!": store.mode === "shell" }}
1310+
style={{ "padding-bottom": space }}
13011311
>
13021312
{placeholder()}
13031313
</div>
13041314
</Show>
13051315
</div>
13061316

1317+
<div
1318+
aria-hidden="true"
1319+
class="pointer-events-none absolute inset-x-0 bottom-0"
1320+
style={{
1321+
height: space,
1322+
background:
1323+
"linear-gradient(to top, var(--surface-raised-stronger-non-alpha) calc(100% - 20px), transparent)",
1324+
}}
1325+
/>
1326+
13071327
<div class="pointer-events-none absolute bottom-2 right-2 flex items-center gap-2">
13081328
<input
13091329
ref={fileInputRef}

0 commit comments

Comments
 (0)