You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple required <fast-radio> elements with the same name attribute aren't grouped together when checking form validity. Each radio is treated as an independent form element.
💻 Repro or Code Sample
This test adds two required <fast-radio> elements to a form, then checks their validity.
test("should be invalid when the `required` attribute is present and no value is selected on multiple radios",async()=>{awaitroot.evaluate(node=>{node.innerHTML=/* html */` <form> <fast-radio required name="test" value="test">test</fast-radio> <fast-radio required name="test" value="test2">test2</fast-radio> </form> `;});constform=page.locator("form");constfirstRadio=page.locator("fast-radio").nth(0);constsecondRadio=page.locator("fast-radio").nth(1);awaitexpect(firstRadio).not.toBeChecked();awaitexpect(secondRadio).not.toBeChecked();awaitexpect(firstRadio).toHaveJSProperty("validity.valueMissing",true);awaitexpect(secondRadio).toHaveJSProperty("validity.valueMissing",true);expect(awaitform.evaluate((node: HTMLFormElement)=>node.checkValidity())).toBe(false);firstRadio.evaluate(node=>{node.dispatchEvent(newMouseEvent("click"));});awaitexpect(firstRadio).toBeChecked();awaitexpect(secondRadio).not.toBeChecked();awaitexpect(firstRadio).toHaveJSProperty("validity.valueMissing",false);awaitexpect(secondRadio).toHaveJSProperty("validity.valueMissing",false);expect(awaitform.evaluate((node: HTMLFormElement)=>node.checkValidity())).toBe(true);awaitsecondRadio.click();awaitexpect(firstRadio).not.toBeChecked();awaitexpect(secondRadio).toBeChecked();awaitexpect(firstRadio).toHaveJSProperty("validity.valueMissing",false);awaitexpect(secondRadio).toHaveJSProperty("validity.valueMissing",false);expect(awaitform.evaluate((node: HTMLFormElement)=>node.checkValidity())).toBe(true);awaitform.evaluate((node: HTMLFormElement)=>{node.reset();});awaitexpect(firstRadio).not.toBeChecked();awaitexpect(secondRadio).not.toBeChecked();awaitexpect(firstRadio).toHaveJSProperty("validity.valueMissing",true);awaitexpect(secondRadio).toHaveJSProperty("validity.valueMissing",true);expect(awaitform.evaluate((node: HTMLFormElement)=>node.checkValidity())).toBe(false);});
🤔 Expected Behavior
Selecting a required <fast-radio> that's grouped with other radios via name should cause all grouped radios to be valid.
😯 Current Behavior
Each radio is individually selectable, with its own validation. Selecting a radio doesn't deselect others, and each radio marked required reports its own validity state.
The text was updated successfully, but these errors were encountered:
🐛 Bug Report
Multiple required
<fast-radio>
elements with the samename
attribute aren't grouped together when checking form validity. Each radio is treated as an independent form element.💻 Repro or Code Sample
This test adds two required
<fast-radio>
elements to a form, then checks their validity.🤔 Expected Behavior
Selecting a required
<fast-radio>
that's grouped with other radios vianame
should cause all grouped radios to be valid.😯 Current Behavior
Each radio is individually selectable, with its own validation. Selecting a radio doesn't deselect others, and each radio marked
required
reports its own validity state.The text was updated successfully, but these errors were encountered: