fix form selection when element is detached (#1806) (#1881)

Co-authored-by: cyantree <cyantree@users.noreply.github.com>
This commit is contained in:
cyantree
2024-03-06 16:34:59 +01:00
committed by GitHub
parent 3bc8495874
commit 2a4b3ee2e9

View File

@@ -72,9 +72,8 @@ export class FormControlController implements ReactiveController {
const formId = input.form;
if (formId) {
const root = input.getRootNode() as Document | ShadowRoot;
const form = root.getElementById(formId);
const root = input.getRootNode() as Document | ShadowRoot | HTMLElement;
const form = root.querySelector(`#${formId}`);
if (form) {
return form as HTMLFormElement;