[Bug]: web blocks become unresponsive when switching focus between two of them

Open Beginner friendly
#3,428 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
frontend

Research direction

Start in frontend/app/block/block.tsx and inspect the focus effect around blockClicked and isFocused, reproducing the issue with two web blocks. Prevent a block that is losing focus from re-grabbing DOM or logical focus; done means switching between two web blocks leaves the newly selected block interactive and stable.

Written by the indexing model from the issue text.

Description

Current Behavior

With two web blocks open, clicking from one web block into the other makes both webviews unresponsive to input — buttons/links don't click, the URL bar can't be edited, typing does nothing. Only the block header icons (right side) still respond.

waveapp.log shows webview-focus flapping continuously between the two webview ids and null:

webview-focus null
webview-focus 23
webview-focus null
webview-focus 24
...

Focus is granted then revoked within a few ms (some events share the same millisecond), so no input ever lands. Terminal→web focus is fine; only web→web breaks.

Root cause is in frontend/app/block/block.tsx. blockClicked is state and lags one commit, so the focus effect also runs while a block is losing focus (stale blockClicked === true, isFocused === false). It can't tell "just clicked" from "just lost focus", so the de-focusing block re-grabs both DOM and logical focus. With two web blocks both doing this, they fight indefinitely. Single webview settles because there's no competitor.

Expected Behavior

Clicking from one web block to another moves focus once and stays there. Both web blocks remain interactive.

Steps To Reproduce
  1. Open two web blocks side by side (e.g. wsh web open https://github.com and wsh web open https://example.com)
  2. Click into web block A, then click into web block B
  3. Try to click a link/button or edit the URL bar in either — input is dead; header icons still work
Wave Version

v0.14.5

Platform

macOS

OS Version/Distribution

macOS 15 (Darwin 25.5.0), Apple Silicon

Architecture

arm64

Anything else?

Fix incoming — guard the re-focus in block.tsx so a block that is losing focus doesn't re-grab it.

Dominant language
Go
Stars
22.3k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wavetermdev/waveterm

All issues in wavetermdev/waveterm

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.