[openstreetmap/openstreetmap-website] make sure iD's iframe is focused on startup (PR #6083)

Martin Raifer notifications at github.com
Tue Jun 3 19:42:22 UTC 2025


@tyrasd commented on this pull request.



> @@ -37,7 +37,8 @@ $(function () {
   id.attr("src", idData.url + "#" + params);
 
   id.ready(function () {
-    if (!this.contentWindow.location.href.startsWith(idData.url)) {
+    id.focus();
+    if (this.contentWindow && !this.contentWindow.location.href.startsWith(idData.url)) {

IMHO not: If there is a `this.contentWindow`, but it (for whatever reason) is not a real `document` object (or a `document` object that does not have a `location` property, etc.), I'd rather see a real exception on this line. :shrug: 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6083#discussion_r2124766622
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6083/review/2893864718 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250603/d8493aca/attachment.htm>


More information about the rails-dev mailing list