From e18d064eeed92a0f329c882808c339e451d94a56 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Wed, 6 May 2026 15:14:33 +0200 Subject: [PATCH] sync location hash on the "History" link in header navigation fixes https://github.com/openstreetmap/iD/issues/12287 --- app/assets/javascripts/router.js | 3 ++- app/helpers/application_helper.rb | 4 ++-- app/views/layouts/_header.html.erb | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/router.js b/app/assets/javascripts/router.js index ed833c625..f7ddb571c 100644 --- a/app/assets/javascripts/router.js +++ b/app/assets/javascripts/router.js @@ -102,9 +102,10 @@ OSM.Router = function (map, rts) { function updateSecondaryNav() { $("header nav.secondary > ul > li > a").each(function () { - const active = $(this).attr("href") === location.pathname; + const active = new URL($(this).attr("href"), location.href).pathname === location.pathname; $(this) + .toggleClass("active", active) .toggleClass("text-secondary", !active) .toggleClass("text-secondary-emphasis", active); }); diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a084cd3cd..dd6072cd5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -41,8 +41,8 @@ module ApplicationHelper def secondary_nav_items items = [ - [history_path, t("layouts.header.history")], - [export_path, t("layouts.header.export")], + [history_path, t("layouts.header.history"), { :class => ["geolink"] }], + [export_path, t("layouts.header.export"), { :class => ["geolink"] }], [traces_path, t("layouts.header.gps_traces")], [diary_entries_path, t("layouts.header.user_diaries")], [communities_path, t("layouts.header.communities")], diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 3d16fbb85..a86c27586 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -34,9 +34,9 @@