[openstreetmap/openstreetmap-website] Make sidebar resizable (PR #3467)

Andy Allan notifications at github.com
Wed Mar 2 15:22:52 UTC 2022


Yeah, unfortunately this change doesn't quite work as I think was intended. In particular it can cause breakage on the map, where if you e.g. expand the sidebar, shrink the browser window, and then shrink the sidebar then the map tiles stop loading on part of the screen.

I think this is because resizing the sidebar, and so resizing the map, confuses leaflet as to its extents and/or centre of the map. Normally when the sidebar appears we need to do various things in javascript to recalculate the size of the map - see the [setSidebarOverlaid function](https://github.com/openstreetmap/openstreetmap-website/blob/45487e1ff8e7d334792440a2b5b3b1067269bfaf/app/assets/javascripts/leaflet.map.js#L302-L313). In fact, since there are dimensions hardcoded into that javascript, that might by and underlying cause of the problems. So without additional changes to the JS, a just-CSS approach isn't going to work, or at least won't work without some refactoring first.

I think also we would need to discuss the "why" part of this. I mean, I'd personally like a wider sidebar, and maybe one that was even wider on a very wide screen. But I wouldn't want one that resets back to narrow on every page load - I would want it to persist. And personally I don't need full freedom to choose arbitrary widths, I'd rather it just worked(tm). And finally I'd probably lean towards some kind of minimum width, since this PR allows you to resize to tiny widths and everything goes a bit broken at that point.

So @Strubbl thank you for the PR, although I'm not going to merge it. I'd be happy to look at a new PR which, unfortunately, would have to deal with the JS/map-related consequences of resizing the sidebar. And even if you don't want to go down that route, I'm interested to know the "why" for resizing the sidebar, i.e. what doesn't work right now for you, to see if there are alternative ways to fix it that might be less complex than diving into the JS and Leaflet behaviour.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3467#issuecomment-1057052126
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3467/c1057052126 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220302/17381a54/attachment.htm>


More information about the rails-dev mailing list