From 54ef03694977cb1504b4570f80e9edb7027007f7 Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Sun, 13 Oct 2024 23:22:49 +0300 Subject: [PATCH] fix(lib): context picker state --- lib/elements/rh-context-picker/rh-context-picker.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/elements/rh-context-picker/rh-context-picker.ts b/lib/elements/rh-context-picker/rh-context-picker.ts index 7669cb7abc..aa260aee60 100644 --- a/lib/elements/rh-context-picker/rh-context-picker.ts +++ b/lib/elements/rh-context-picker/rh-context-picker.ts @@ -116,8 +116,10 @@ export class RhContextPicker extends LitElement { this.sync(); } else if (this.target) { const root = this.getRootNode() as Document | ShadowRoot; - this.#target = root.getElementById(this.target); - this.sync(); + if (root instanceof Document || root instanceof ShadowRoot) { + this.#target = root.getElementById(this.target); + this.sync(); + } } else { this.#target = this.closest('rh-surface'); }