[openstreetmap/openstreetmap-website] Fix social link form resubmission after removing invalid link (PR #6945)

Matt Van Horn notifications at github.com
Fri Mar 27 08:38:41 UTC 2026


## Summary

Fixes #6903.

When a social link row is removed after a validation error, the row is hidden (`d-none`) and the `_destroy` checkbox is checked, but the text input keeps its `required` attribute. HTML5 validation then blocks form submission because it cannot focus the hidden required field.

This adds a single line to strip the `required` attribute from the text input when marking a social link for destruction.

## Reproduction

1. Go to profile links editor with no existing links
2. Add a valid URL, then add a second empty social link
3. Submit - server returns validation error on the empty link
4. Remove the errored link
5. Try to submit again - **before this fix**, nothing happens and the console logs "invalid form control is not focusable"

## Test plan

- Added system test covering the exact reproduction scenario
- Existing social link tests continue to pass (add, remove, keyboard navigation, multi-link management)
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/6945?email_source=notifications&email_token=AAK2OLO6ECX5KASQCYZKPOL4SY4ZDA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTINJVG44DQNJUHCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVVYHEX3POBSW4X3DNRUWG2Y

-- Commit Summary --

  * fix: remove required attribute when hiding social link row

-- File Changes --

    M app/assets/javascripts/user.js (1)
    M test/system/profile_links_change_test.rb (26)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/6945.patch?email_source=notifications&email_token=AAK2OLIYHZKNFMDOY5GP4S34SY4ZDA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTINJVG44DQNJUHCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZYHEX3QMF2GG2C7MNWGSY3Lhttps://github.com/openstreetmap/openstreetmap-website/pull/6945.diff?email_source=notifications&email_token=AAK2OLMGDAGBSXIWW5G7Y434SY4ZDA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTINJVG44DQNJUHCTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVVYHEX3ENFTGMX3DNRUWG2Y
-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6945
You are receiving this because you are subscribed to this thread.

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


More information about the rails-dev mailing list