Project

General

Profile

Bug #224

Updated by Eugene Suhanov 3 months ago

Two unrelated storefront corrections, split across two branches. 

 **Cart scroll (item 2) — reproduced.** `cart/index.blade.php:29` puts `max-h-[750px] overflow-y-auto` on the 
 item list. At 375×812 with four lines the region measures `clientHeight 750 / scrollHeight 767` and spans 
 y=80→830 — **the nested scroller covers the entire viewport below the header**. A swipe anywhere over the 
 cart therefore travels 17px inside the inner region instead of scrolling the page. Lines measure 192px on 
 seeded data, so the local threshold is 4; production names wrap taller, which is why the report says 3. The 
 summary block repeats the shape with `max-h-[280px]`. 

 The header dropdown is **not** the culprit despite matching the phrase "shopping cart" — `app.css:97` sets 
 `.cart-preview__panel { display: none }` under `@media (hover: none)`, so it never renders on a phone. 

 Fix: drop the inner `max-h` / `overflow-y-auto` below the existing `900px` breakpoint on both regions so the 
 page scrolls as one document, and drop `<x-scroll-hint>` with them on mobile. On a phone there is no second 
 column to keep aligned, so the nested scroller buys nothing and costs the page its natural scroll. 
 `overscroll-behavior: contain` was considered and rejected — it *stops* scroll chaining, which makes the 
 trap total rather than merely annoying. 

 **Occasion filter (item 3).** `CatalogController::index()` passes `$this->options->occasions()` straight to 
 the view — every active occasion, never intersected with the category. Demonstrable on seeded data today: 
 visible products carry 5 distinct occasions but the filter offers 6, so **`rande` is rendered and matches 
 nothing, even at `category=all`**. 

 Fix: a new memoized `CatalogOptions::occasionsForCategory(?string $slug)` — one `DISTINCT products.occasion` 
 query, **intersected** with the active occasions list. The intersection is load-bearing, not defensive: 
 `products.occasion` is a free-text slug column with no foreign key (see 
 `2024_01_01_000024_normalize_product_occasions.php`, which had to slugify it by hand), so the distinct set 
 can legitimately contain values matching no `occasions` row. Prune at `category=all` too — a filter option 
 that can only ever return nothing is noise everywhere. An occasion that is already selected but absent from 
 the pruned list still renders, checked, so the customer can see why the grid is empty and clear it; silently 
 dropping their filter would change the results under them. 

 This diverges from how empty **categories** are treated (greyed and inert, not hidden). That is deliberate: 
 the category pills are a navigational shelf where absence reads as missing stock, whereas the occasion list 
 is a filter. Not recorded as an ADR — it is a one-line revert. 

 **Branches:** `fix/mobile-cart-scroll`, then `feat/category-scoped-occasion-filter`

Back