mirror of
https://github.com/bitbaum/chatkit.git
synced 2026-12-03 21:07:24 +01:00
* fix(scroll): back at the bottom by hand, the jump button goes (0.22.1) A finger rocks back a pixel or two as it lifts; that last touchmove read as scrolling up and paused following at the bottom, so the jump button stayed over the reply chips with nowhere to jump to (OrangeCat's Diplodoctor chat on Android, 2026-11-01). A touch that ends at the very bottom, or a downward scroll that arrives there, resumes following. Browser test on ChatScreen at 390px with real touch: fails on 0.22.0, passes now; a real tap on the button still lands at the latest message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtms1H9g9uu7AdDgJzLQ * feat(replies): when an answer ends on a question, the chips answer it Under four questions about a sore finger, Diplodoctor's chips were "I have more info" and "Consult a doctor": a tap answered nothing. On its live model, 2 of 9 chip sets answered the question; 7 of 9 with this sentence. In REPLIES_INSTRUCTION, every fleet chat gets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtms1H9g9uu7AdDgJzLQ --------- Co-authored-by: Claude <noreply@anthropic.com>
20 lines
852 B
JavaScript
20 lines
852 B
JavaScript
/**
|
|
* How close to the bottom still counts as "following the conversation". Above
|
|
* this, the reader is reading something older and must not be yanked back
|
|
* every time a token arrives — the bug in every chat here except loki's and
|
|
* orangecat's.
|
|
*/
|
|
export const FOLLOW_THRESHOLD_PX = 120;
|
|
export function isFollowing(el, threshold = FOLLOW_THRESHOLD_PX) {
|
|
return el.scrollHeight - el.scrollTop - el.clientHeight < threshold;
|
|
}
|
|
/**
|
|
* Close enough to the bottom that nothing is left to jump to: a finger's
|
|
* lift-off wobble, sub-pixel rounding. Far tighter than the follow threshold,
|
|
* so a deliberate small scroll up still pauses following.
|
|
*/
|
|
export const AT_BOTTOM_PX = 16;
|
|
export function isAtBottom(el, slack = AT_BOTTOM_PX) {
|
|
return el.scrollHeight - el.scrollTop - el.clientHeight <= slack;
|
|
}
|
|
//# sourceMappingURL=scroll.js.map
|