Conversation
anurag629
left a comment
There was a problem hiding this comment.
Thanks @bhushan4work, this mostly works. The pill shows when text arrives while you're scrolled up, hides on a click or a manual scroll to the bottom, and stays hidden at the bottom, and the tests cover each of those. All checks pass, including e2e. A few things need to change before it can go in:
-
addMessagenow checksnearBottom()after the new message is already in the log (packages/widget/src/dom/messages.ts:130), so the message's own height counts against the 48px. A reply whose first chunk is two lines or more (widget.ts:968), or an error reply (widget.ts:929and:1014), arrives while the visitor is at the bottom, doesn't scroll into view, and shows the pill instead. dev works outfollowbefore appending, so keep that order. -
Clicking or pressing Enter on the pill hides it while it has focus, so focus falls to
document.body. In the popup that breaks Escape-to-close and the Tab trap, since both listen on the panel (packages/widget/src/dom/panel.ts:89-99). If the pill had focus, move it to the message input before hiding it, and add a test for where focus ends up. -
The label should be the
newReplylocale string from the issue.MessageActions.newReply(messages.ts:31) is never set, so addnewReply: 'New reply'to the English strings inpackages/widget/src/i18n.tsand pass it inactionLabels()(widget.ts:618). Keep the arrow out of the text, since screen readers say "New reply down arrow", and draw it in CSS instead, for example.cc-pill::after { content: " ↓" / ""; }. -
Some of the rewrites made to fit the size limit change behavior:
transition: 0.2s(widget.css:21, and the same in five other rules) animates every property, so the panel's size and position now animate too when the layout switches at 640px..cc-message-retry:hover(widget.css:359) lostcolor: var(--cc-danger), so Retry turns to the normal text color on hover.font: 13px inherit(widget.css:569) is invalid, so the browser drops it and the pill gets its default button font. Usefont-family: var(--cc-font); font-size: 13px;like.cc-consent-btn.
Please put those back. The other rewrites can stay. I know they came from the budget (the first run was 51 B over the panel's 19 kB). If it's still over once these are back, say by how much here and I'll make room in a separate PR.
|
@anurag629 lets get this one merged first followed by my other pr . lemme know if any followup fixes are needed . also do a rerun for ci , as its passing locally |
anurag629
left a comment
There was a problem hiding this comment.
Thanks @bhushan4work, all four points are fixed. follow is worked out before the append again, focus moves to the input when the pill had it (with a test), the label comes from newReply with the arrow drawn in CSS, and the transitions, Retry's hover color and the pill's font match dev. That left the panel 35 B over, so I raised its budget to 19.2 kB in #596 and updated your branch. The e2e failure on the earlier run was the runner failing to download Playwright's system fonts, not your change. All checks pass, including e2e.
#594 still needs the two changes from my review there.
|
Merged, thanks @bhushan4work. |
What does this change?
Shows a "New reply ↓" pill button at the bottom of the log when a streaming reply or
addMessageadds text while the visitor is scrolled up (nearBottom()is false). Clicking the pill smooth-scrolls to the bottom (jumping immediately ifprefers-reduced-motion: reduce), manually scrolling to the bottom hides it, and it stays hidden when already at the bottom.Closes #420
How I tested this
packages/widget/tests/dom/stream.test.tsverifying pill visibility when text arrives while scrolled up, hiding when manually scrolling to bottom, smooth scrolling on click, and jumping on reduced motion.e2e/tests/stream-render.spec.tsasserting the pill is visible innew text doesn't pull the log down while the visitor reads above it.pnpm lint,pnpm size(within 19 kB budget forchatcops.panel.js),pnpm --filter @chatcops/widget test,pnpm test:coverage, and e2e Playwright tests.AI assistance
None
Checklist
devpnpm -r build,pnpm testandpnpm -r typecheckpass locallypnpm changeset) if this changescore,widgetorserverpnpm apirun andapi/committed if an exported type or option changed