Skip to content

fix: fix misbehaving greeting buttons so they work after 3+ attempts#10

Merged
devDariush merged 3 commits into
mainfrom
fix/greeting-buttons-misbehaving
Feb 17, 2026
Merged

fix: fix misbehaving greeting buttons so they work after 3+ attempts#10
devDariush merged 3 commits into
mainfrom
fix/greeting-buttons-misbehaving

Conversation

@devDariush

Copy link
Copy Markdown
Owner

After the second click on the greeting links (like about, contact and social), it did not send any commands or open any website.

This PR fixes it.
Root cause: handleBlur in [TerminalInput.svelte:33] calls focus() without preventScroll: true. After two commands produce enough content to overflow the terminal, clicking a greeting link at the top triggers this sequence:

mousedown on button → input loses focus → blur fires
handleBlur calls focus() → browser scrolls the terminal container down to show the input
The button moves out from under the cursor
mouseup fires on a different element → no click event → handleLinkClick never runs

Fix: Added { preventScroll: true } to three focus() calls:

[TerminalInput.svelte:35] — the primary fix
[Terminal.svelte:121] — prevents scroll when clicking terminal body
[Terminal.svelte:117] — prevents scroll after link click
Claude Opus

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 17, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
dariushdev-sveltekit 37b42d8 Commit Preview URL

Branch Preview URL
Feb 17 2026, 11:52 PM

@devDariush devDariush marked this pull request as ready for review February 17, 2026 23:39
Copilot AI review requested due to automatic review settings February 17, 2026 23:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug where greeting link buttons (about, contact, social) stop working after 2-3 clicks when terminal content overflows. The issue occurs because focus() calls without preventScroll cause unwanted scrolling that moves buttons out from under the cursor, preventing click events from firing.

Changes:

  • Added { preventScroll: true } option to focus() calls in TerminalInput.svelte and Terminal.svelte
  • Prevents browser from scrolling when refocusing the input element
  • Ensures buttons remain under the cursor for successful click event completion

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lib/components/TerminalInput.svelte Added preventScroll: true to handleBlur focus call (primary fix)
src/routes/Terminal.svelte Added preventScroll: true to handleLinkClick and focusInput methods

Comment thread src/routes/Terminal.svelte
Comment thread src/routes/Terminal.svelte
@devDariush devDariush merged commit bccd605 into main Feb 17, 2026
2 checks passed
@devDariush devDariush deleted the fix/greeting-buttons-misbehaving branch February 17, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants