Skip to content

Conversation

@chrisdavidmills
Copy link
Contributor

This PR adds some basic <geolocation> element examples to the repo.

I am linking to examples here rather than embedding them on the documentation pages because when I tried using live samples, the examples wouldn't work due to a limitation on the number of <geolocation> elements allowed on the same page.

@chrisdavidmills chrisdavidmills requested a review from a team as a code owner January 14, 2026 13:40
Copy link
Member

@pepelsbey pepelsbey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to crash Chrome right when I asked it for geolocation permissions for the first time. I couldn’t reproduce it again. So I think it wasn’t caused by the demo itself 😬

Otherwise, pretty cool! Thanks.

I only noticed that <button id="fallback"> is never queried as #fallback in querySelector, only as button. So I would either remove id="fallback" (since it’s not used) or do querySelector("#fallback"). I think the latter one is slightly more consistent with the rest of the code. On the other hand, there’s querySelector("p"), so I’m not 100% sure.

Up to you!

@chrisdavidmills
Copy link
Contributor Author

I managed to crash Chrome right when I asked it for geolocation permissions for the first time. I couldn’t reproduce it again. So I think it wasn’t caused by the demo itself 😬

Ha, yes, that happened to me once or twice, too. I reported the crash each time, so hopefully they'll sort that out.

I only noticed that <button id="fallback"> is never queried as #fallback in querySelector, only as button. So I would either remove id="fallback" (since it’s not used) or do querySelector("#fallback"). I think the latter one is slightly more consistent with the rest of the code. On the other hand, there’s querySelector("p"), so I’m not 100% sure.

Good spot. I've updated the IDs to make them a bit more consistent in my latest commit. Shouldn't take too long to fix in the accompanying docs.

Cheers!

@chrisdavidmills chrisdavidmills merged commit 9d93965 into mdn:main Jan 16, 2026
1 check passed
@chrisdavidmills chrisdavidmills deleted the geolocation-element-examples branch January 16, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants