[openstreetmap/openstreetmap-website] Fix: prevent form submission breaking language selector (#6598) (PR #6599)

Parvesh Kumar notifications at github.com
Mon Dec 8 18:43:57 UTC 2025


### Summary
This PR fixes issue #6598, where pressing **Enter** inside the language selector modal causes the modal to get stuck on an endless loading spinner.

### Root Cause
For logged-in users, the language selector loads a `<form>` inside the `select_language_list` Turbo Frame.  
Pressing Enter triggers an **unintended form submission**, but the server response is **not Turbo-frame compatible**, so Turbo cannot replace the frame content.

As a result:
- the Turbo Frame stays in the "loading" state,
- reopening the modal shows the spinner forever,
- only a full page refresh restores normal behavior.

Logged-out users do not see this bug because their modal contains no form.

### Fix
This change prevents the Enter key from causing a form submission inside the language selector modal.  
Avoiding the submission ensures the Turbo Frame continues to behave normally and reloads the language list as intended.

### Testing
- Reproduced issue locally using Docker environment.
- Verified that the spinner freeze no longer occurs when pressing Enter.
- Confirmed that both logged-in and logged-out behaviors remain correct.
- No regressions observed in language selection or modal behavior.

### Additional Notes
- Change follows project coding standards (ESLint for JS).
- Commit history is clean and scoped to the fix.
- Does not modify any localization files except `en.yml` if necessary (none needed here).

You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Fix: prevent form submission breaking language selector (#6598)

-- File Changes --

    M app/assets/javascripts/language_selector.js (11)

-- Patch Links --

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

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

Message ID: <openstreetmap/openstreetmap-website/pull/6599 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251208/2767da55/attachment.htm>


More information about the rails-dev mailing list