Repository navigation
Visual review fixes: touch affordances, cart overlay, and merchant-set social links - #10
Conversation
The card's only link was the Discover button, which lives in a row that only comes out of its collapsed state on hover. A phone and a tablet have no hover, so the card had nothing to click at all. A transparent link covers it where the pointer is coarse — a sibling of that button rather than its ancestor, since an <a> inside an <a> is invalid markup. The overlay settings beside it were showing both modes at once: the inputs arrive from `overlayInputs` already carrying their own solid/gradient tests, and this schema wrote over them. Composing the editorial requirement onto each one instead leaves a merchant who picked Solid with the solid fields and nothing else. The placeholder behind a collection with no image takes the theme's own grey rather than Tailwind's.
All Products went from one column straight to four at 1024px, so every width from 512px up showed a single card stretched across a tablet and then four 232px cards a pixel later. The count now climbs with the theme's own breakpoints; the collection grid, which jumped the same way between the merchant's two settings, climbs with it. The "Filtered by" chips existed only on the collection page. The search page computed `appliedFilters` in its loader and never drew them, so the only record of an active filter was a checkbox inside a drawer. The row moves into a shared component and both pages render it, outside the has-results branch: a filter that narrows the results to none is exactly the one that has to be undoable. Two faults came out of that work. Shopify escapes `/` as `\/` inside a filter value's `input`, which `JSON.stringify` does not, so a colour — the only filter whose value carries a taxonomy gid — never matched an applied one and could not be switched back off. And "Clear all" pointed at the bare pathname, which threw away the search term along with the filters. The 48px band above the collection results and the hand-rolled copy of the secondary button in the search drawer both go; the button is the variant it was always meant to be.
Every link carried the button corner radius: it sat on the base of the `Link` variants rather than on the variants that draw a button. A product card title also carries `line-clamp-2`, whose `overflow: hidden` then cut the glyphs at those rounded corners — the first letter of a title lost the left side of its stem. The radius moves to the four button-shaped variants, which is the only place it means anything. The tiles an image loads into were `bg-gray-100`, a Tailwind grey beside a theme whose every other surface is set by the merchant. They take `--color-line-subtle` instead, so a card reads as a card while the file is still in flight.
The volume pricing table opened from a tooltip, which answers hover and nothing else, so on a phone or a tablet it could not be read at all. Rather than bend the tooltip into opening on tap, each pointer gets the primitive built for it and CSS decides which one is in the document — a popover where the pointer is coarse, the tooltip where it is not. The purchase method panel let its list slide sideways inside itself. The tablet variant table has no column of its own for it, so the control is squeezed into the variant cell at around 186px while "Deliver every month, 10% off" needs about 220, and the first character of every row was cut off. The panel is now as wide as its options and never narrower than the control, and only scrolls down. The slide counter under the media came from Swiper's fraction pagination and only ever showed below `md`, where the progress bar and the row of thumbnails already say which slide is up. The quick shop panel starts its media 40px down rather than 56px, the close button having moved to the corner on a phone.
`useOptimisticCart` lays every cart fetcher that still carries `formData` over the cart it is given, and React Router keeps `formData` through both `submitting` and `loading` — so the overlay outlives the action that produced it. The cart reaches the drawer as a deferred promise, and a revalidated one can resolve while the fetcher is still loading: the line is then counted once by the server and once by the overlay. Removing a product and adding it straight back showed it as 2 until the fetcher finally went idle. The overlay is worth keeping only while the cart in hand predates the mutation. A baseline taken during `submitting` — the one state where React Router guarantees no loader has revalidated — is compared against the line quantities now on screen, and the overlay is dropped when they differ or when no baseline could be taken at all. The fingerprint is the quantities rather than `updatedAt`, whose second resolution cannot separate a removal from the add that follows it. It drops the overlay wholesale: Hydrogen computes inside a clone it owns, so one fetcher's contribution cannot be taken back out without reimplementing its matching rules. Two overlapping mutations therefore undercount for an instant, which is a smaller lie than the overcount. All five call sites read through it, the badge in the header included, so the drawer and the count above it cannot disagree. A line Shopify has not priced yet now holds its cell with the placeholder a repricing line uses. `useOptimisticCart` builds a newly added line from the variant alone, with no `cost`, and the price cell was simply empty until the reply landed. The three cart dialogs take the corner radius the rest of the theme's panels have.
The floor applied to every touch pointer, so an input read 16px beside a 14px label on Android and in DevTools' device emulation — a visible mismatch bought for nothing, since neither zooms on focus. Only WebKit on iOS does, which is what made the search drawer hang off the edge of the page in the first place. `-webkit-touch-callout` ships on iOS and nowhere else, so the floor is scoped to it. Chrome and Firefox on iOS come along, correctly: they are WebKit underneath and zoom like Safari does. The comment carries the trap with it — Chromium parses several `-webkit-` properties, `-webkit-user-select` among them, so an `or` added to make the test feel sturdier would match Chrome and undo the narrowing.
The announcement bar drew a fixed Instagram, Facebook and X from four settings buried in the Footer group, where a merchant looking at the icons on the bar had no reason to open. Each row now owns its slots and its links, and the bar's sit on the bar's own panel. A slot picks what it shows from eight marks and where it goes, and a count governs how many are on screen — the same "… to show" range the sections use for their items, so the panel is as long as the row the merchant is actually building. Turning the count down takes an icon off the page without clearing the fields behind it. Theme settings have no repeater input, so the run is fixed and `SOCIAL_SLOT_COUNT` is the one number that lengthens it. The conditions are written as closures that override `toString`: Weaverse hands theme-setting conditions to Studio as source text, where a closure's captured slot number is not in scope, and workerd refuses to build functions from strings. The Instagram section's handle is a link from the moment the section is added. It read a "Profile link" that no preset filled, so the tag sat there as plain text; it falls back to the handle on instagram.com, which also keeps the two from ever disagreeing.
The guard that drops the optimistic overlay once the server has applied it sits in the middle of how the cart renders, and nothing else in the pipeline would notice it going: typecheck and the build are both happy with a cart that counts a pending line twice for a second. The suite drives the real Hydrogen hook over scripted fetcher states and asserts the unguarded hook still doubles, so a refactor that quietly removes the guard fails here rather than in a shopper's drawer.
hta218
left a comment
There was a problem hiding this comment.
Thanks for this one. The write-ups are excellent, the settled-cart guard and its CI suite are well reasoned, and the Link radius, filter matching and iOS-only 16px fixes all look right. There are two things I'd like changed before merge. Moving to slot-based social settings silently drops the links merchants have already saved. The cart baseline also goes stale when a keyed fetcher is re-submitted before it goes idle. Beyond those, there's one accessibility point on the volume-pricing trigger and a handful of nits inline.
| label: "Facebook", | ||
| placeholder: "https://www.facebook.com/your-page", | ||
| }, | ||
| ...socialSlots("footerSocial", [ |
There was a problem hiding this comment.
This replaces socialInstagram / socialX / socialLinkedIn / socialFacebook with new footerSocial* / topbarSocial* keys, and nothing reads the old ones anymore (git grep socialInstagram returns nothing). Every store that already filled those links loses its footer and announcement-bar icons the moment this deploys: the new …Link fields start empty, and resolveSocialSlots skips any slot without a link. Could we keep a fallback, for example letting resolveSocialSlots fall back to the legacy keys when no slot of the row has a link? At the very least, call this out as a breaking settings change in the CHANGELOG / release notes so merchants know to re-enter them.
There was a problem hiding this comment.
Fixed in 8e446f4e. A row with no link in any of its slots now falls back to the old keys — slots still decide the marks and their order, only the links come from socialInstagram / socialX / socialLinkedIn / socialFacebook. The fallback ends per row as soon as one slot has a link, so the bar and the footer migrate separately.
I verified the premise rather than assuming it: @weaverse/hydrogen/dist/index.mjs:1824 merges { ...defaultThemeSettings, ...result.theme } without filtering by schema key, and this store's theme payload still carries the four old values beside the new slot keys. CHANGELOG notes it anyway.
| } | ||
| live.add(fetcher.key); | ||
|
|
||
| if (!baselines.has(fetcher.key)) { |
There was a problem hiding this comment.
The baseline is only taken the first time a key is seen. A keyed fetcher re-submitted while it is still loading (double-tapping Add to cart, or the line stepper keyed by line id) goes loading → submitting with no idle render in between. The old baseline therefore survives. If the first mutation's cart has already landed, the second submission compares against the stale fingerprint and its overlay is dropped for its whole flight, so the badge and totals don't move until the server answers. The PR's own invariant covers the fix: a cart read during submitting can't contain this submission, so re-take the baseline on every submitting render:
if (fetcher.state === "submitting") {
baselines.set(fetcher.key, fingerprint);
continue;
}
if (!baselines.has(fetcher.key)) {
stale = true;
continue;
}A scripted case in optimistic-cart.test.mjs would be worth adding: submitting → loading (server landed) → submitting again on the same key.
There was a problem hiding this comment.
Applied as written, 14a724de. The invariant does carry it: a cart read during submitting can't contain that submission, first on its key or not.
Test added in the same commit — submitting → landed → submitting again on the same key → in flight → landed, all through one play so each step measures against the baselines the previous ones left. 7/7.
| <Popover.Root> | ||
| <Popover.Trigger asChild> | ||
| {/* A button rather than the bare icon: tapping it is the only way | ||
| in here, and it is the only way by keyboard either. */} |
There was a problem hiding this comment.
This comment says the button is "the only way by keyboard", but the button sits inside hidden pointer-coarse:inline-flex. On a desktop (fine pointer) it is display: none, and the tooltip trigger is still the bare <InfoIcon> SVG, which can't take focus. Keyboard users on desktop still can't reach the volume table. Using the same <button type="button" aria-label={t("product.volumePricing")}> as the TooltipTrigger asChild child (line 825) would fix that, since Radix Tooltip opens on focus.
There was a problem hiding this comment.
Right on both counts, ae520d91. The tooltip trigger is the same <button type="button" aria-label={t("product.volumePricing")}> now, so Radix opens it on focus.
The comment was worse than missing — it asserted the opposite of what the markup did, from inside an element that is display: none on a fine pointer. Rewritten to describe the touch branch only.
|
|
||
| /** | ||
| * One transition of the per-fetcher baselines against the cart now on screen. | ||
| * Pure so scripted event sequences can drive it in tests the way the hook's |
There was a problem hiding this comment.
nit: settlementStale isn't pure. It mutates the baselines map it's given (set and delete). Maybe "Takes the baselines as an argument so scripted event sequences can drive it…" instead.
There was a problem hiding this comment.
Fixed: "Takes the baselines as an argument — and writes to them — so scripted event sequences can drive it the way the hook's ref does across renders."
| "We are a team of designers, developers, and creatives...", | ||
| }, | ||
| { | ||
| // The footer's own row, four slots deep. Shaped like the bar's so |
There was a problem hiding this comment.
nit: "four slots deep" doesn't match the code. The row has SOCIAL_SLOT_COUNT (6) slots, and four are shown by default.
There was a problem hiding this comment.
Fixed — "four marks shown of the six it can hold."
| type: "text" as const, | ||
| name: `${prefix}${index}Link`, | ||
| label: `Link ${index}`, | ||
| placeholder: "https://www.instagram.com/your-handle", |
There was a problem hiding this comment.
nit: every slot's Link placeholder is https://www.instagram.com/your-handle, even when the slot's icon is Facebook, YouTube and so on. A neutral https:// placeholder, or one derived from defaultIcon, would read better.
There was a problem hiding this comment.
Fixed. Added SOCIAL_LINK_PLACEHOLDERS, keyed by the slot's defaultIcon, falling back to https:// for anything not listed.
| * the shop's accounts — but both draw from this same set of marks, so the | ||
| * lookup lives in one place rather than being copied into each. | ||
| */ | ||
| export const SOCIAL_ICONS: Record<string, { name: string; Icon: Icon }> = { |
There was a problem hiding this comment.
nit: SOCIAL_ICONS is only used inside this file, so it can drop the export.
| row that lets the button keep its own width and leaves the rest | ||
| of the line empty, so it hugs its label and starts where the | ||
| rows above it do rather than filling the panel. */} | ||
| <div className="mt-6 flex items-start justify-start"> |
There was a problem hiding this comment.
nit: items-start justify-start are the flex defaults, and since Link is inline-flex a plain block wrapper already lets it hug its label: <div className="mt-6"> is enough. The comment above also pins Figma values (#F0EFED, 12px, 24×18) that will go stale as soon as the theme tokens change. Consider trimming it to the intent ("use the secondary button variant rather than a hand-rolled copy").
There was a problem hiding this comment.
Both done — <div className="mt-6">, and shrink-0 went with the flex container since it no longer meant anything. Comment trimmed to the intent, Figma values gone.
Moving each row onto its own slots left the four settings that used to feed both of them — `socialInstagram`, `socialX`, `socialLinkedIn`, `socialFacebook` — with nothing reading them. The new `…Link` fields start empty and a slot without a link is skipped, so every shop that had filled those in would have lost its footer and announcement-bar icons on the deploy. A row with no link typed into any of its slots is read as one not yet filled in rather than one deliberately emptied, and the old settings answer for it. The slots still decide which marks appear and in what order; only the links come from the old keys, and only for the four platforms that had one. That test asks the links rather than the accounts built from them. A slot whose link is filled in but whose icon is still "none" produces no account, and reading that as an untouched row brought the old links back under a merchant who had plainly started moving across. Every slot counts, not only the ones the count currently reveals, so turning the count down cannot resurrect the fallback either. The CHANGELOG carries the change, since the fields a merchant knows are gone from Studio either way.
The baseline was taken only the first time a key was seen. A keyed fetcher submitted again before it goes idle — a double-tapped Add to cart, a stepper keyed by line id — runs `loading` straight into `submitting` with no idle render in between, so the first baseline survived. Once the first mutation had landed, the second submission was compared against a fingerprint it had already changed and its overlay was dropped for the whole of its flight: the badge and the totals sat still until the server answered. The invariant the guard already rests on covers it. A cart read during `submitting` cannot contain *that* submission, whether or not it is the first on its key, so the baseline is re-taken every time. The suite gains the sequence: submitting, landed, submitting again on the same key, in flight, landed again — carried through one `play` so each step is measured against the baselines the ones before it left behind. `settlementStale` no longer claims to be pure. It writes to the map it is handed, which is how the hook's ref behaves across renders and the whole reason tests can drive it.
The tooltip branch hung on a bare `<InfoIcon>`, and an <svg> cannot take focus — so on a desktop the table was reachable by hover and by nothing else. Radix opens a tooltip on focus as well, which a button gives it. The comment on the touch branch claimed to be the only way in by keyboard, while sitting inside `hidden pointer-coarse:inline-flex`: on a fine pointer it is not in the document at all. Each slot's Link placeholder follows the mark that slot ships with, rather than offering an Instagram address under a Facebook icon. The heading above the footer's row said four slots where there are six, four of them shown. The wrapper around See All Results is a plain block again — `items-start` and `justify-start` are the flex defaults, and an `inline-flex` link hugs its label without help. Its comment keeps the intent and drops the Figma values, which would have gone stale the moment a token moved.
|
All eight are in, across One hole beyond the eight, found while testing the fallback: deciding it on "did any account come out" rather than "has a link been typed" meant a slot with a link but its icon still
|
Eight commits closing the November 12 visual review. 37 files, +1099 / −268.
What changed, and where
3d5a7ac9f34f5882ff4b103b74cd712997ec21b2cba43ac115cd645617ab1126Three worth reading closely
97ec21b2— the cart counted a pending line twice.useOptimisticCartapplies every fetcher still carryingformData, and React Router keepsformDatathroughloadingas well assubmitting. The cart arrives as a deferred promise, so a revalidated one can land while the fetcher is still loading: server and overlay both count the line. Removing a product and adding it straight back showed it as 2 for about a second.A baseline is taken during
submitting— the one state where React Router guarantees no loader has revalidated — and compared against the line quantities now on screen. The fingerprint is quantities rather thanupdatedAt, whose second resolution cannot separate a removal from the add that follows it. All five call sites read through the wrapper, the header badge included.ff4b103b— titles were clipped by a border radius. The button corner radius sat on the base of theLinkvariants, so it reached plain text links too. A product card title carriesline-clamp-2, whoseoverflow: hiddenthen cut glyphs at those corners — the first letter lost the left side of its stem. The radius moved to the four button-shaped variants.cba43ac1— the 16px floor was costing more than it bought. It applied to every coarse pointer, so inputs read 16px beside 14px labels on Android and in DevTools emulation, neither of which zooms on focus. Scoped to-webkit-touch-callout, which ships on iOS and nowhere else.Verification
biome,typecheck,build— cleancart:ownership-check10/10,cart:overlay-check6/6Scope of that manual pass
One account, one browser, on a local worker. Not exercised: the deployed Oxygen runtime, a second concurrent cart mutation, or a slow network where the deferred
cart and the fetcher land further apart.
Cart ownership is untouched here —
app/.server/context.ts,app/ucart-owner.account.tsandserver.tscarry no changes, so theaccount-handover behaviour needs no fresh manual pass; its suite still runs green in CI.Trade-offs taken knowingly
review-10was resolved in Studio, not in code.Closes #14