<p dir="auto">Originally was in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2459415506" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/5064" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/5064/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/5064">#5064</a> but I took it out because it solves a different problem.</p>
<p dir="auto">The problem is:</p>
<ol dir="auto">
<li>right-click somewhere on the map, select "Directions from here": a starting marker appears on the map</li>
<li>right-click some other place, select "Directions to here": first, another marker appears, then a route</li>
<li>close the directions form so you're no longer on the directions page but don't do a full page reload<br>
<a href="https://github.com/user-attachments/assets/cbecff06-79c5-4154-a1ad-025d38086093">image.png (view on web)</a></li>
<li>scroll to a different place on the map</li>
<li>right-click and select "Directions from here"</li>
</ol>
<p dir="auto">What do you expect to happen after step 5? Probably the same thing that happened after step 1: a starting marker appearing. But that's not what's going to happen. A route is going to be built from your new start to an old destination you picked in step 2. This will likely be accompanied by an annoying zoom-out to fit the route if you scrolled far away in step 4.</p>
<p dir="auto">This PR clears endpoint values when leaving the directions page. This prevents building a route to an old endpoint in step 5.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5101'>https://github.com/openstreetmap/openstreetmap-website/pull/5101</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5101/commits/1e9603c7b1eed068d5c18d98d4505e1c6a764f81" class="commit-link">1e9603c</a> Remove endpoint/input values on disable</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5101/files">1 file</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5101/files#diff-720e11d91a0c3a64a70dd6bfad46c242e9f4755b2470797031de5b55ff9a8c5d">app/assets/javascripts/index/directions-endpoint.js</a>
(3)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5101.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5101.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5101.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5101.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5101">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPR2L7UDR3EWTXBIO3ZSRJ33AVCNFSM6AAAAABM3SAEWSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TONBZGQZDQMY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLLW3DQD5UC54PNQZXTZSRJ33A5CNFSM6AAAAABM3SAEWSWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJHK4QBM.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5101</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5101",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5101",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>