[openstreetmap/openstreetmap-website] Don't zoom in when commenting/closing a note. (#648)
danieldegroot2
notifications at github.com
Fri Sep 22 22:43:29 UTC 2023
For both zooming in / zooming out issue;
Related code for (clicking on) notes is located at [this line](https://github.com/openstreetmap/openstreetmap-website/blob/a796c41881c26e6da8828a71dbfb533613e5a83f/app/assets/javascripts/index/note.js.erb#L103C75-L103C75) if you want to skip looking through the commits.
The only expected behaviour with this code
- When entering the website with a -note etc.- URL without location parameters, go to the default zoom.
The observed behaviour:
- On selecting the first note, you will retain the location parameters. On the second you will not. When closing or commenting, the check 'is it a url with location parameters?' no longer checks out, sending you to the default zoom as before. See the recording for #4256 and look at how the URL bar changes on each action, for example.
- They will also be lost when the first note is selected, the page is reloaded (note stays 'selected') and the note is re-selected
(re-selecting the first note this way is not possible without reloading the page.)
- They will furthermore not show up when first choosing the "Add a note" tool, then selecting a second note.
Doing something else as mentioned [above](https://github.com/openstreetmap/openstreetmap-website/issues/648#issuecomment-30221163) will add back location parameters and escape this issue, though there may be other ways to tinker with the URL.
I suppose the site initially adds the `note/id` in front of the location parameters. And, in above cases, it replaces this part or just the id and throws away the rest. In the last case, there is nothing to throw away behind `note/new`, so it stays as-is.
This could also happen when there's a javascript error and you get a full page reload instead of a partial reload, according to Anton. However, I think [this](https://github.com/openstreetmap/openstreetmap-website/issues/3730#issuecomment-1288852590) is/was a different issue. Anyhow, I personally do not get any (javascript) errors.
This could be (partially) fixed by checking if a note is selected, or alternatively always re-adding parameters after loading.
(maybe neither is practical though, there might be an easier fix.)
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/648#issuecomment-1732102275
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/648/1732102275 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230922/d1a4584d/attachment-0001.htm>
More information about the rails-dev
mailing list