fix: responsive grid breakpoints for small screens (#41) #50
Reference in New Issue
Block a user
Delete Branch "ai/issue-41-responsive-grid-breakpoints"
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?
Closes #41
Problem
Dashboard grid was fixed at 12 columns, so on a phone a 6-wide widget only got half a ~380px viewport.
Fix
GridStackLayout.setResponsiveBreakpoint(maxWidthPx, columns): configures gridstack'scolumnOpts(window-width breakpoint,breakpointForWindow: true).DashboardViewwires it at 768px → 1 column, so widgets stack full-width below that width.grid-stack.ts:localStoragepersistence while the live column count differs from the configured full column count — gridstack's own responsive collapse fires the samechangeevent a real drag/resize would, andsave()while collapsed reports the forced 1-column shape. Without the guard, narrowing the window would silently overwrite the saved desktop layout.grid.setStatic(...)via amatchMedialistener at the same breakpoint, so drag/resize is disabled on the stacked mobile view (touch rearranging a single-column stack is mostly misfires).grid.column()), not custom code — verified it isn't lost by the persistence guard above.Tests
ResponsiveGridPlaywrightTest(new): drives a real browser at 1280×900 and 375×720.mobileViewport_stacksWidgetsFullWidthAndDisablesDragging: widget width matches grid width below the breakpoint,grid-stack-staticclass present.collapsingToMobile_doesNotOverwriteThePersistedDesktopLayout:localStorageentry is byte-for-byte unchanged across a collapse, and the widget returns to its exact desktop slot../mvnw test: 78/78 green.