[openstreetmap/openstreetmap-website] Remove required attribute from social link fields marked for destruction (PR #6937)
Copilot
notifications at github.com
Wed Mar 25 08:09:22 UTC 2026
@Copilot commented on this pull request.
## Pull request overview
Fixes a browser-native HTML validation blocker when removing social links after a server-side validation error on the profile links form, by ensuring hidden “marked for destruction” rows no longer contain required inputs.
**Changes:**
- Remove the `required` attribute from social link URL inputs when a row is marked for destruction (both on click and on initial page load).
- Add system tests covering removal of an invalid social link after a validation error (new link and persisted link scenarios).
### Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
| ---- | ----------- |
| `app/assets/javascripts/user.js` | Ensures hidden/destroyed social link rows don’t retain `required` inputs that would block resubmission. |
| `test/system/profile_links_change_test.rb` | Adds system tests to reproduce and prevent the reported “hidden required field” resubmission failure. |
---
💡 <a href="/openstreetmap/openstreetmap-website/new/master?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
> $(".social_link_destroy input[type='checkbox']:checked").each(function () {
- $(this).closest(".row").addClass("d-none");
+ const row = $(this).closest(".row");
+ row.addClass("d-none");
+ row.find("input[type='text']").removeAttr("required");
});
The JS now removes the `required` attribute both when clicking Remove and when `_destroy` checkboxes are already checked on page load, but the added system tests only cover the in-page removal case. Consider adding a system test that forces a re-render with `_destroy` already checked (e.g., remove one link, keep another invalid so the form re-renders, then fix remaining errors and resubmit) to ensure the on-load path prevents native HTML validation from blocking submission.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6937#pullrequestreview-4004755066
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6937/review/4004755066 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260325/2b45bfcc/attachment-0001.htm>
More information about the rails-dev
mailing list