Closed ghost closed 2 years ago
I believe it already does, to the maximum extent possible - browsers do not allow all of these click types to be intercepted.
See 528d4a040e593f6ce2171167c436dbdf27511711 and 77b4ff6ceb81a326b7ed3c80cf5d65ec2a2b18d5 for previous work on this.
It really doesn't work in Firefox. Seems like jQuery-simulate isn't doing its job properly then.
IMHO, it's a bit overkill as well when you could just do something like
function clickChangeset(id, e) {
var url = "/changeset/"+id;
if (e.button===1 || e.ctrlKey) {
window.open(url);
} else {
window.location = url;
}
}
No, the problem is that it isn't possible. Middle click events are simply never delivered by the browser, so the click handler never even runs, and ctrl-click can't simulated in Firefox at least - see https://bugzilla.mozilla.org/show_bug.cgi?id=812202 for details.
Oh and your solution is not acceptable as it assumes what middle mouse and/or ctrl will do - that is up to the browser UI designer and/or the user configuring the browser and we have no way of knowing what they have chosen. That is why we simulate the event instead so that the correct browser action can be triggered.
I see, but now nothing works in Firefox ... I don't know about other browsers. On my phone it doesn't work either.
(Edit: same in Chromium.)
Actually my first thought was to make the <a>
a big block element with all the stuff in it (and make all that stuff in it inline objects like <span>
since <a>
can't have block elements inside of it, and restore their block with CSS) but then you lose semantics. And it doesn't solve the map view.
You could also provide an opt-in for the 'bad' behaviour in the user settings.
Please let openstreetmap.org/user/.../history respect middle-clicks and Ctrl+clicks: open them in a new window.
On the links itself in the list it works since they are just your old HTML
<a>
's, but the rest of the list item is a JavaScript link. Also clicking the bounding box in the map should respect this.This is especially important since the history list does not remember state, i.e. each time I go back in the browsing history, only the 20 first changesets are shown.