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

Story education shadow reset. #27421

Merged
merged 1 commit into from Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion extensions/amp-story-education/0.1/amp-story-education.css
Expand Up @@ -15,6 +15,7 @@
*/

@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,700');
@import '../../amp-story/1.0/amp-story-shadow-reset.css';

amp-story-education {
position: fixed !important;
Expand All @@ -32,10 +33,12 @@ amp-story-education {
height: 100% !important;
width: 100% !important;
background: rgba(0, 0, 0, 0.8) !important;
color: #FFF !important;
font-family: 'Open Sans', sans-serif !important;
font-weight: 400 !important;
pointer-events: auto !important;
opacity: 1 !important;
text-rendering: geometricPrecision !important;
transition: opacity 225ms cubic-bezier(0.0, 0.0, 0.2, 1) !important;
}

Expand Down Expand Up @@ -135,7 +138,7 @@ amp-story-education {
color: #FFF !important;
font-size: 16px !important;
font-weight: 600 !important;
line-height: 44px !important;
line-height: 43px !important;
}

@keyframes i-amphtml-tap-outer {
Expand Down
6 changes: 5 additions & 1 deletion extensions/amp-story-education/0.1/amp-story-education.js
Expand Up @@ -96,7 +96,11 @@ export class AmpStoryEducation extends AMP.BaseElement {
this.containerEl_.classList.add('i-amphtml-story-education');
toggle(this.containerEl_, false);
this.startListening_();
createShadowRootWithStyle(this.element, this.containerEl_, CSS);
// Extra host to reset inherited styles and further enforce shadow DOM style
// scoping using amp-story-shadow-reset.css.
const hostEl = this.win.document.createElement('div');
this.element.appendChild(hostEl);
createShadowRootWithStyle(hostEl, this.containerEl_, CSS);

this.viewer_ = Services.viewerForDoc(this.element);
const isMobileUI =
Expand Down