Skip to content

[lit-labs/observers] ResizeController cannot easily observe a target other than host #3147

@sorvell

Description

@sorvell

Which package(s) are affected?

Observers (@lit-labs/observers)

Description

ResizeController accepts a target element to observe. It observes the given target when the host is connected and/or when the controller is added to the host. Unfortunately, the target is set after this, so if the host is already connected, the target doesn't get observed.

Reproduction

https://lit.dev/playground/#gist=c79371cc956785c4cb5ed5a99cb93cbf

Workaround

The user must manually call observe to workaround this issue. This is demonstrated in the repro.

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

all

Browser/OS/Node environment

All

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions