vscode-elements / elements

Web component library for developing Visual Studio Code extensions
https://vscode-elements.github.io
MIT License
156 stars 27 forks source link

RadioGroup: multiple groups mistakenly influence others #179

Closed neko-para closed 1 month ago

neko-para commented 1 month ago

I'm using jquery to dynamic create contents, thus here's the screenshot of elements page

QQ_1728394991827

        for (const opt of target.option) {
            const optId = `target-${target.id}-${opt.id}`;

            formEl.append($('<vscode-label></vscode-label>').text(opt.name).attr('for', optId));

            const selEl = $('<vscode-radio-group></vscode-radio-group>');
            selEl.attr('id', optId);

            for (const cs of opt.case) {
                const optEl = $('<vscode-radio></vscode-radio>');
                optEl.text(cs.name);
                if ((target.config[opt.id] ?? opt.def) === cs.value) {
                    optEl.attr('checked', '');
                }
                selEl.append(optEl);
            }
            formEl.append(selEl);
        }

QQ_1728395027553

When I click one radio, other three all got unchecked.

https://github.com/user-attachments/assets/d310ff95-a032-4d00-8c38-62fb1add1595

bendera commented 1 month ago

Use different name attributes for the Debug/Release and the SAAS/Local groups.