add global styles in the shadow root #437
Closed
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.
The main reason why the styles are failing is because the styles for google map are added in the head of the document where google map api is called.
The
this.$.map
is defined in the shadow-root where the styles are encapsulated, therefore the styles are not applied.When google maps api changed from version 3.34 to 3.35, they added 2 more img tags for each buttons and the global styles were suppose to handle the overlay.
The one way to fix this is to copy the style nodes into the shadow root of the
google-map
web component.I added a mutation observer when the web component has been attached to observe the head of the document. When the style node that contains the text
gm-
is added then the node gets copied the shadow root.This should also fix other problems that arises that depends on global styles.
Resolves #435 and #423 and other issues that arises from global styles not cascading down into shadow-root.