From ac07dbfd69b5831d9f5ad2502ac1086aa1d3c6d2 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Tue, 3 Jun 2025 13:19:01 +0200 Subject: [PATCH] make sure iD's iframe is focused on startup to allow it to accept keyboard shortcuts directly after loading fixes https://github.com/openstreetmap/iD/issues/9828 also fix the annoying false-positive exception on iD startup, see https://github.com/openstreetmap/openstreetmap-website/pull/5823#discussion_r2035464188 --- app/assets/javascripts/edit/id.js.erb | 2 +- app/views/site/_id.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/edit/id.js.erb b/app/assets/javascripts/edit/id.js.erb index c66335768..6ec864c5a 100644 --- a/app/assets/javascripts/edit/id.js.erb +++ b/app/assets/javascripts/edit/id.js.erb @@ -37,7 +37,7 @@ $(function () { id.attr("src", idData.url + "#" + params); id.ready(function () { - if (!this.contentWindow.location.href.startsWith(idData.url)) { + if (this.contentWindow && !this.contentWindow.location.href.startsWith(idData.url)) { location.reload(); } }); diff --git a/app/views/site/_id.html.erb b/app/views/site/_id.html.erb index 6b6c69798..dd0acd730 100644 --- a/app/views/site/_id.html.erb +++ b/app/views/site/_id.html.erb @@ -7,5 +7,5 @@ data[:zoom] = @zoom if @zoom data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx] data[:url] = id_url(:locale => params[:locale]) %> - <%= tag.iframe "", :frameBorder => 0, :id => "id-embed", :class => "w-100 h-100", :allowfullscreen => "", :data => data %> + <%= tag.iframe "", :frameBorder => 0, :id => "id-embed", :class => "w-100 h-100", :allowfullscreen => true, :autofocus => true, :data => data %> -- 2.39.5