Another autofocus-related change in addition to #5899.

Normally on map view pages we have the search input autofocused. But on the 
*Add a note* page it makes sense to focus on the note description input. Since 
it may be loaded in the sidebar after the regular page load, we're focusing 
with javascript instead of a html attribute.

Now try adding a note on a phone with a small screen. What's normally a 
sidebar now takes up the upper half of the screen. You get the lower half to 
see the map and to place the note marker. Except not really because the virtual 
keyboard shows up as soon as the description input gains focus, that is right 
away:

![Screenshot_20250406-144921](https://github.com/user-attachments/assets/1c313e5c-516f-46fc-8174-b98614c33389)

This PR adds [a 
workaround](https://gist.github.com/supertanuki/1f73f9aa33d5010bf07205804596e042)
 to suppress the initial focus from triggering the virtual keyboard. The proper 
API for that [is still 
experimental](https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard_API).
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5900

-- Commit Summary --

  * Fix typo in moveNewNoteMarkerToClick
  * Replace deprecated jQuery .focus() with .trigger("focus")
  * Avoid virtual keyboard when visiting new node page

-- File Changes --

    M app/assets/javascripts/index/new_note.js (14)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5900.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5900.diff

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

Message ID: <openstreetmap/openstreetmap-website/pull/5...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to