fix: only clear overlay root when assigning a renderer if needed #7313
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is needed for
vaadin-combo-box
Lit version to prevent issue with re-creatingvaadin-combo-box-scroller
.Currently with the Lit version, setting
overlay.renderer
triggers observer inOverlayMixin
which clearsinnerHTML
without checking for the old renderer. Then on overlay open, the scroller is re-attached by callingappendChild()
.This isn't the case in Polymer version where observers run differently and clearing
innerHTML
is called before the first renderer invocation byrequestContentUpdate()
. Note: changing all the properties to usesync: true
doesn't help.While
vaadin-combo-box
Lit tests pass on the main branch, they start to fail in Safari after postponing the virtualizer initialization until open in #7277 - and apparently the fact that scroller is reattached is related to that.I figured out that we don't need to clear
innerHTML
anyway if there is no old renderer yet.Type of change