Skip to content

Commit dcfe2d2

Browse files
committed
style(prompt-field): trim scroll-paging comments to standalone one-liners
1 parent a64a8b1 commit dcfe2d2

3 files changed

Lines changed: 3 additions & 10 deletions

File tree

2nd-gen/packages/swc/patterns/conversational-ai/prompt-field/PromptField.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,10 +702,7 @@ export class PromptField extends SpectrumElement {
702702
return;
703703
}
704704

705-
// Scroll to the tile that starts the next/previous page rather than a
706-
// blind clientWidth: near the end only one item may remain, and a full
707-
// page-width would overshoot and then snap back. scrollIntoView lands on
708-
// the tile's snap point directly and clamps to the content edge.
705+
// Scroll the page-start tile into view: snap-aligned, clamps at the edge.
709706
const scrollRect = scrollEl.getBoundingClientRect();
710707
const pageStart = this._isRtl()
711708
? scrollRect.right - direction * scrollEl.clientWidth

2nd-gen/packages/swc/patterns/conversational-ai/prompt-field/prompt-field.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,7 @@
217217
overflow-y: hidden;
218218
scroll-behavior: smooth;
219219

220-
/* proximity, not mandatory: the has-scroll-prev/next classes change
221-
* scroll-padding-inline when a chevron appears, and mandatory would force an
222-
* instant re-snap to the new alignment (a visible yank). Paging still lands
223-
* aligned because it scrollIntoViews the target tile. */
220+
/* proximity avoids a forced re-snap when the chevrons change scroll-padding */
224221
scroll-snap-type: inline proximity;
225222
scroll-padding-inline: token("spacing-75");
226223
scrollbar-color: token("gray-400") transparent;

2nd-gen/packages/swc/patterns/conversational-ai/prompt-field/test/prompt-field.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,7 @@ export const ArtifactScrollPaginationTest: Story = {
348348
const tiles = scrollEl
349349
?.querySelector('slot')
350350
?.assignedElements({ flatten: true }) as HTMLElement[] | undefined;
351-
// proximity is the default strictness, so it is omitted from the
352-
// computed value ('inline'); only mandatory would be serialized.
351+
// Computed scroll-snap-type omits proximity (the default); only mandatory serializes.
353352
const snapType = getComputedStyle(scrollEl!).scrollSnapType;
354353
expect(snapType).toContain('inline');
355354
expect(snapType).not.toContain('mandatory');

0 commit comments

Comments
 (0)