Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reattach state when child elements change #118

Merged
merged 1 commit into from
Mar 6, 2024
Merged

Conversation

camertron
Copy link
Contributor

In certain scenarios, most notably Turbo navigation, <auto-complete> elements do not respond to events like keypresses and appear to be entirely non-functional. This is because the element relies on certain child elements being present in the DOM when connectedCallback fires, an assumption that is not always accurate, i.e. in the Turbo case. This PR adds a mutation observer that triggers a callback when the child elements have loaded. The callback performs the necessary setup that makes the element function normally.

@camertron camertron marked this pull request as ready for review March 5, 2024 23:20
@camertron camertron requested a review from a team as a code owner March 5, 2024 23:20
@camertron camertron requested a review from keithamus March 5, 2024 23:20
Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@keithamus keithamus merged commit 48c2d2c into main Mar 6, 2024
4 checks passed
@keithamus keithamus deleted the reattach_on_mutate branch March 6, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants