Mobile follow up number 3 #76
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
gtfs.zone/coloring-book#76
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Follow-up polish pass on mobile support (#74). Fixes four concrete issues: (1) The bottom sheet height overshoots on Firefox mobile (bottom URL bar) and occasionally on Chrome because
window.innerHeightreturns the layout viewport, not the visual viewport. Fix: usedvhCSS units directly in the inlinestyle.heightassignments so the browser tracks the dynamic viewport automatically — no JS listeners needed. (2)--dock-heightis set to4remfallback becausesyncDockHeight()runs before the dock has laid out. Fix: replace with aResizeObserveron#mobile-dock, which fires after first paint and on every subsequent resize. This also fixes the basemap-control buttons that sit behind the dock (they usecalc(var(--dock-height) + 10px)). (3) The browse tab'stab-contentdiv has no height, so whenobject-details-viewis shown (which usesh-full flex flex-col), the scroll container collapses to content height instead of filling the panel. Fix: one CSS rule inmain.css. (4) The "Load" dropdown hasz-[1](loses to thez-40map controls overlay) and the Load button shows a download arrow instead of an upload arrow.Approach: minimal targeted changes, no refactors.
Relevant Context
src/modules/bottom-sheet.ts— allwindow.innerHeightusages are at lines 88, 139, 140, 172, 173;syncDockHeight()is the private method at line 39; theResizeObservershould replace thesyncDockHeight()call in the constructor (line 25) and thethis.syncDockHeight()call in the resize listener (line 33)src/styles/main.css:29–69— the@media (max-width: 767px)block with--dock-height: 4remfallback and.basemap-controloverridesrc/index.html:163–189— the Load dropdown:#load-btn(SVG at lines 170–183) and#load-dropdown(z-[1]at line 189)src/index.html:422–503— right-panel tabs;tab-contentdiv at lines 433 and 513 and 559 has no height class; childrenbrowse-list-view/object-details-viewhaveh-fulldvhunit:1dvh = 1% of the dynamic viewport height, which tracks the browser chrome automatically. Supported in all modern browsers. Assign as a string literal toelement.style.height.Phase 1: dvh Heights + ResizeObserver for Dock
Goal: fix the panel height overshooting the visual viewport (Firefox bottom URL bar, Chrome 1mm scroll), and fix
--dock-heightbeing stale at startup (which also fixes basemap buttons behind the dock).src/modules/bottom-sheet.tsIn
setSnap, replace the pixel height computation withdvhstrings:dvhis a live CSS value — the browser recalculates it automatically when the URL bar slides in/out, with no JS event needed.In
onMove(drag handler), replacewindow.innerHeight * FULL_VHwith(window.visualViewport?.height ?? window.innerHeight) * FULL_VHfor the drag cap:During a live drag the height is set as pixels, so we need the current visual viewport height at that moment.
In
resolveSnap, replace bothwindow.innerHeightreferences with(window.visualViewport?.height ?? window.innerHeight):Remove the
syncDockHeight()private method entirely.In the constructor (after
setSnap('closed', false)), replace thethis.syncDockHeight()call with aResizeObserveron the dock:ResizeObserverfires after the first layout, so it always gets the real rendered height (includingenv(safe-area-inset-bottom)padding). It also fires on orientation change, which covers the resize case.In the
window.addEventListener('resize', ...)handler, remove thethis.syncDockHeight()call (ResizeObserver handles it). The handler becomes:Gotcha:
ResizeObservercallback fires asynchronously after layout, so on the very first frame the CSS fallback--dock-height: 4remis used. This is fine — the observer fires almost immediately and the panel isn't visible atsnap=closed. The basemap control'scalc(var(--dock-height) + 10px)will also update correctly once the observer fires.Gotcha:
dvhis not supported in very old browsers but is supported in all evergreen browsers (Chrome 108+, Firefox 110+, Safari 15.4+). This is acceptable.Phase 2: Browse Panel Height Fix
Goal: prevent the
object-details-viewscroll container from collapsing to content height when an object is selected on the map.Root cause: DaisyUI's
.tab-contentrenders inside a CSS grid (.tabs) but has no explicit height, soh-fullchildren resolve against a zero-height ancestor. The right panel is correctly sized (flex-1 min-h-0), but the height doesn't propagate through to.tab-content.src/styles/main.css@layer components(or directly in the file after the mobile media query block), add: This scopes the fix to the right panel only, avoiding unintended side effects on othertabscomponents elsewhere.Gotcha:
overflow-y-autois already on.tab-contentin the HTML. Combined withheight: 100%, the content will scroll within the panel rather than expanding past it.Gotcha: "sometimes" behavior — the collapse happens when
object-details-viewis shown (flex-col withflex-1 overflow-y-autochildren) because the flex-1 child cannot resolve its height without a parent height anchor. The list view doesn't exhibit this because its content naturally fills the space.Phase 3: Load Button Icon + Dropdown Z-index
Goal: show the correct upload icon on the Load button; make the Load dropdown appear above the map-controls overlay.
src/index.htmlOn
#load-dropdown(line 189), changez-[1]toz-[50]:The
#map-controlsdiv isz-40; raising the dropdown toz-[50]makes it appear above the search and tool buttons.In
#load-btn(lines 170–183), replace the download-arrow SVG path with the upload-arrow path. The current path (M9 19l3 3m0 0l3-3m-3 3V10) draws a downward arrow. Replace only that one<path>element:This matches the upload icon already used on the
#upload-btnmenu item inside the dropdown. Both web and mobile see the same#load-btn(the text is hidden on mobile viahidden md:inlinebut the icon is always visible).Original Issue
Follow-up to the CURRENT_PLAN.md (#74 mobile polish). Issues observed after that pass:
--dock-heightis not being calculated correctly at startup on mobile — dock is sometimes inaccessible because the panel overlaps it; basemap control buttons are behind the dock as a consequence.