[openstreetmap/openstreetmap-website] Remove required attribute from social link fields marked for destruction (PR #6937)

Alex Towell notifications at github.com
Wed Mar 25 08:04:53 UTC 2026


## Summary

Fixes #6903

When a social link is removed via the "Remove" button after a validation error, the row is hidden with `d-none` but the URL input retains its `required` attribute (added by `bootstrap_form` from the model's presence validation). The browser blocks form submission with _"The invalid form control with name='user[social_links_attributes][1][url]' is not focusable"_ because a hidden required field cannot pass native HTML validation.

- Remove the `required` attribute from the URL text input when a social link row is marked for destruction
- Also handle the on-load case where `_destroy` checkboxes are already checked

## Test plan

- [ ] Added two system tests that reproduce the exact scenario from #6903: submit with an empty link to trigger validation, remove the empty link, resubmit
- [ ] Existing social link system tests continue to pass
- [ ] Manual verification: follow the steps in the issue and confirm form submits successfully after removing the invalid link

🤖 Generated with [Claude Code](https://claude.com/claude-code)
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Remove required attribute from social link fields marked for destruction

-- File Changes --

    M app/assets/javascripts/user.js (5)
    M test/system/profile_links_change_test.rb (53)

-- Patch Links --

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

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

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


More information about the rails-dev mailing list