mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 15:34:58 +00:00
docs(ds-toggle): warn against external hidden_field_tag with same name (#1925)
DS::Toggle already renders a paired hidden field for the off-state value. Adding an external `hidden_field_tag` with the same `name` in a caller view causes ID/label collisions (the auto-generated id matches the checkbox id, so `<label for=...>` targets the hidden field) and sends duplicate params. Inline ERB comment so the warning surfaces wherever the component is read or copied.
This commit is contained in:
committed by
GitHub
parent
2ce8e858b6
commit
4bb326fee5
@@ -1,4 +1,5 @@
|
||||
<div class="relative inline-block select-none">
|
||||
<%# Paired hidden field carries the off-state value when the checkbox is unchecked. Do NOT add an external `hidden_field_tag` with the same `name` in the caller view — it causes ID/label collisions and duplicate params. %>
|
||||
<%= hidden_field_tag name, unchecked_value, id: nil %>
|
||||
<%# `role="switch"` upgrades the underlying checkbox so AT users hear
|
||||
"switch, on" / "switch, off" instead of "checkbox, checked". The
|
||||
|
||||
Reference in New Issue
Block a user