JetBrains / JetBrains/thinkrail

Wheel input during the last frame of the return to Latest is swallowed (newest-first)

Open
#459 0 comments 0 reactions 1 assignee Claimed by @danyaberezun View on GitHub
bug
Dominant language
TypeScript
Stars
467
Forks
37
Avg merge
1d 56m
Merged PRs (30d)
141

Description

## Description

In a newest-first chat, a wheel gesture that arrives during the last frame of the programmatic return to *Latest* is swallowed: the transcript does not move, the reader is not detached, and the *Latest* button never appears. `apps/web/src/chat/SPEC.md` (§ *One cancellable, retargetable motion owner*) says the first real reader movement cancels the motion synchronously and native physics win — that holds for most of the return, but not for its final write. The scroller is at `scrollTop = 1` with `data-scroll-moving="true"` when the wheel lands, and the motion's final write to `0` overrides it.

Found while adjusting `e2e/chat-order.spec.ts` in #458 (the test now waits for `data-scroll-moving="false"` before wheeling, which is why it no longer catches this).

## Steps to reproduce

Deterministic (Playwright, against `bun run e2e`'s dev host), on `main` after #458 lands or on the `cross-platform-title-bar-integration` branch:

1. In `e2e/chat-order.spec.ts`, test `newest-first scrolls down into history and returns upward to the latest group`, delete the line
`await expect(chatScroll).toHaveAttribute("data-scroll-moving", "false");` that precedes the third `page.mouse.wheel(0, 10_000)`.
2. Run `bun run e2e -- e2e/chat-order.spec.ts -g "newest-first scrolls down into history"`.
3. Optionally log `scroller.scrollTop`, `data-scroll-moving` and `data-follow-state` right before and ~800 ms after that wheel.

By hand (timing-sensitive): open a long chat in newest-first order, scroll down into history, click **Latest**, and start scrolling down again just as the return animation reaches the top.

## Expected behavior

The wheel cancels the return, the transcript scrolls into history, `data-follow-state` becomes `detached`, and **Latest** reappears.

## Actual behavior

`scrollTop` goes `1 → 0`, `data-follow-state` stays `following`, the 10 000 px wheel delta produces no movement, and `scroll-to-top` never mounts:

```
before wheel: {"scrollTop":1,"moving":"true","follow":"following"}
after wheel: {"scrollTop":0,"moving":"false","follow":"following"}
```

## Environment

- OS: macOS 26.6.2 (Chromium via Playwright 1.61)
- Bun version (`bun --version`): 1.4.2
- Node version (`node --version`): 25.9.0
- ThinkRail version / commit: `3f39dc89` (branch `cross-platform-title-bar-integration`, PR #458)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.