Skip to content

Flying carpet: make container full viewport and center content#8292

Merged
dvoytenko merged 1 commit intoampproject:masterfrom
dvoytenko:fixes125
Mar 24, 2017
Merged

Flying carpet: make container full viewport and center content#8292
dvoytenko merged 1 commit intoampproject:masterfrom
dvoytenko:fixes125

Conversation

@dvoytenko
Copy link
Copy Markdown
Contributor

@dvoytenko dvoytenko commented Mar 21, 2017

Closes #8097.

The flying carpet's container has to be full screen and center its content.

// Hmm, can the page height change and affect us?
user().assert(
layoutBox.top >= viewportHeight,
layoutBox.top >= viewportHeight * 0.8,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/cc @jasti, we discussed this before and decided to collapse when flying carpet when the effect would be broken.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@jridgewell I'm okay with this since the overlap and the box could be a max of 0.2 * viewport. Worst case will look like this, which still shows the bottom of the content on scroll.

screen shot 2017-03-21 at 8 52 19 pm

Missing anything? (btw, didn't find any documentation asking not to add flying carpet in the first and last viewport - did we just miss it?)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worse case is actually when it appears on the first viewport and does not touch the bottom of the viewport (so the whole carpet is visible in first viewport). Then, you'll never see the bottom of the content.

No documentation was written, just an issue you brought up in hangouts.

-webkit-transform: translateZ(0) !important;

/* Center contents in the container */
display: flex;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this play well with other centering techniques? If not, we should definitely bump the version.

Alternatively, this could be done with a container element and a flex-item amp-child.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it will play well. But I'm still testing around. Just added a good improvement to support responsive layout as well. PTAL.

Copy link
Copy Markdown
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

I have no understanding of flex-box. If you say this will work, LGTM. Defering to @jasti about the broken implementation in the first/last viewport.

@dvoytenko
Copy link
Copy Markdown
Contributor Author

@jridgewell @jasti as mentioned, I'm splitting this fix from positioning fixes. Will run those in a separate issue/PR. Will merge this fix as soon as green. Thanks!

@dvoytenko dvoytenko changed the title TBD: Flying carpet: make container full viewport and center content Flying carpet: make container full viewport and center content Mar 23, 2017
@dvoytenko dvoytenko merged commit b341d26 into ampproject:master Mar 24, 2017
@dvoytenko dvoytenko deleted the fixes125 branch March 24, 2017 17:27
lironzluf pushed a commit to lironzluf/amphtml that referenced this pull request Mar 28, 2017
* master: (34 commits)
  Prevent amp-carousel next/previous icons fade away on desktop (ampproject#8428)
  Turn on flag slidescroll-disable-css-snap” (ampproject#8436)
  Revert "temporarily turn off yarn (ampproject#8356)" (ampproject#8384)
  initial commit (ampproject#8404)
  Upgrades for Index Exchange amp-ad tags to report load statistics (ampproject#8054)
  amp-bind validation tweak (ampproject#8414)
  Fix an amp-instagram race condition (ampproject#8192)
  Use whitelist to restrict urlReplacement for scoped analytics element (ampproject#8360)
  Report active experiments in error logs (ampproject#8108)
  amp-bind: Catch exceptions in mutatedAttributesCallback (ampproject#8383)
  Fixing custom scroll-snap on IOS (ampproject#8391)
  Add experiment for using AmpContext class in integration.js (ampproject#8348)
  add (ampproject#8349)
  swipe api (ampproject#8357)
  skip 3 flaky tests (ampproject#8388)
  amp-bind: Expression complexity limit (ampproject#8321)
  add margin-bottom (ampproject#8350)
  Flying carpet: make container full viewport and center content (ampproject#8292)
  Service Registration: Document Click (ampproject#7882)
  Add a8ad (ampproject#8036)
  ...
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants