Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(mobile): the filter pill hugs its chips and the list switcher clears the dock (#2104)

Maurice142863769424
diff --git a/client/src/mobile/screens/collections/MCollections.tsx b/client/src/mobile/screens/collections/MCollections.tsx
index dc4c115e3..fcab6997e 100644
--- a/client/src/mobile/screens/collections/MCollections.tsx
+++ b/client/src/mobile/screens/collections/MCollections.tsx
@@ -169,9 +169,11 @@ export default function MCollections() {
)}
</div>
- {/* List switcher dropdown (in flow, like the design) */}
+ {/* List switcher dropdown (in flow, like the design). In map view it is a
+ flex item of a viewport-high column, so it has to cap itself and give
+ way rather than push its last entries under the dock (#2104). */}
{drop && (
- <div className="-mt-[6px] mb-3 rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop p-[6px] shadow-[0_16px_40px_-20px_rgba(0,0,0,.4)]">
+ <div className="-mt-[6px] mb-3 max-h-[50dvh] min-h-0 overflow-y-auto rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop p-[6px] shadow-[0_16px_40px_-20px_rgba(0,0,0,.4)]">
<button
type="button"
onClick={() => selectList(ALL_SAVED)}
diff --git a/client/src/mobile/screens/dashboard/MDashboard.tsx b/client/src/mobile/screens/dashboard/MDashboard.tsx
index dc2c10072..3f5067e1d 100644
--- a/client/src/mobile/screens/dashboard/MDashboard.tsx
+++ b/client/src/mobile/screens/dashboard/MDashboard.tsx
@@ -132,12 +132,13 @@ export default function MDashboard(): React.ReactElement {
return (
<>
<div className="mt-[14px] flex items-center gap-[7px]">
- {/* The chips scroll inside their own flexible box on narrow viewports
- or large system font scales; without it this row was the widest
- thing on the page and dragged the fixed bars off-screen under
- Android's forced zoom. min-w-max keeps the pill track wrapping
- its chips instead of getting squeezed to the box. */}
- <div className="m-hscroll min-w-0 flex-1">
+ {/* The chips scroll inside their own box on narrow viewports or large
+ system font scales; without it this row was the widest thing on
+ the page and dragged the fixed bars off-screen under Android's
+ forced zoom. min-w-max keeps the pill track wrapping its chips,
+ and the box stays content-wide (no flex-1) so the pill still hugs
+ them on wide phones while ml-auto parks the icons on the right. */}
+ <div className="m-hscroll min-w-0">
<MSegmented<TripFilter>
value={tripFilter}
onChange={setTripFilter}
@@ -150,7 +151,7 @@ export default function MDashboard(): React.ReactElement {
]}
/>
</div>
- <MIconBtn ariaLabel={t('dashboard.subscribeAllTrips')} size={36} className="flex-none" onClick={() => setSubOpen(true)}>
+ <MIconBtn ariaLabel={t('dashboard.subscribeAllTrips')} size={36} className="ml-auto" onClick={() => setSubOpen(true)}>
<CalendarPlus size={15} strokeWidth={2} className="text-m-muted" />
</MIconBtn>
<button
diff --git a/client/tests/unit/mobile/collections/MCollections.test.tsx b/client/tests/unit/mobile/collections/MCollections.test.tsx
index a103da0e5..0a54d38fc 100644
--- a/client/tests/unit/mobile/collections/MCollections.test.tsx
+++ b/client/tests/unit/mobile/collections/MCollections.test.tsx
@@ -490,6 +490,19 @@ describe('MCollections', () => {
expect(container.firstElementChild!.className).not.toContain('h-dvh')
})
+ it('FE-MOB-COLSCR-019d: the open list switcher scrolls instead of hiding its last entries behind the dock (#2104)', () => {
+ mocks.coll = makeHook({ view: 'map' })
+ render(<MCollections />)
+
+ fireEvent.click(switcher())
+ // In the viewport-high map column the panel is the only item that can give
+ // way, so it has to cap and scroll itself to keep "new list" reachable.
+ const panel = screen.getByRole('button', { name: /collections.newList/ }).parentElement!
+ expect(panel.className).toContain('overflow-y-auto')
+ expect(panel.className).toContain('min-h-0')
+ expect(panel.className).toMatch(/max-h-\[/)
+ })
+
it('FE-MOB-COLSCR-020: a map view with nothing mappable falls back to the empty note', () => {
mocks.coll = makeHook({ view: 'map', mappable: [] })
render(<MCollections />)
diff --git a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx
index 267f1d4d2..fd421a87a 100644
--- a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx
+++ b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx
@@ -552,6 +552,17 @@ describe('MDashboard', () => {
const wrapper = track.parentElement as HTMLElement;
expect(wrapper.className).toContain('m-hscroll');
expect(wrapper.className).toContain('min-w-0');
- expect(wrapper.className).toContain('flex-1');
+ });
+
+ it('FE-MOB-DASH-039: the filter pill hugs its chips instead of filling the row', async () => {
+ render(<MDashboard />);
+
+ // flex-1 on the scroll box stretched the grey pill track all the way to the
+ // calendar icon on phones from ~400px up; the icons ride on ml-auto instead.
+ const chip = await screen.findByText('dashboard.filter.planned');
+ const wrapper = chip.closest('button')!.parentElement!.parentElement as HTMLElement;
+ expect(wrapper.className).not.toContain('flex-1');
+ expect(screen.getByRole('button', { name: 'dashboard.subscribeAllTrips' }).className)
+ .toContain('ml-auto');
});
});