Skip to content

Commit

Permalink
fix form selection when element is detached (#1806) (#1881)
Browse files Browse the repository at this point in the history
Co-authored-by: cyantree <cyantree@users.noreply.github.com>
  • Loading branch information
cyantree and cyantree authored Mar 6, 2024
1 parent 3bc8495 commit 2a4b3ee
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/internal/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2a4b3ee

Please sign in to comment.