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

Set fixed min-height on main page #2942

Merged
merged 6 commits into from
Feb 2, 2021
Merged

Set fixed min-height on main page #2942

merged 6 commits into from
Feb 2, 2021

Conversation

jimbo
Copy link
Contributor

@jimbo jimbo commented Jan 12, 2021

Description

The Main component, which renders the header, page, and footer, sets min-height: 100vh on the page. As intended, this style prevents the footer from ever appearing above the fold. Unfortunately, setting a height with relative units causes issues when the page is rendered in an <iframe>, so we'll have to remove it.

This PR changes to min-height: 40rem (640px) and addresses any fallout from that change.

Related Issue

PWA-1243.

Acceptance

Verification Stakeholders

Specification

Verification Steps

  1. Visit the home page.
  2. Verify that the footer is at least 640px below the header.
  3. Repeat for /cart, /checkout, and other pages.
  4. On an empty page or 404 page, ensure the footer is only 640px below the header.

Screenshots / Screen Captures (if appropriate)

Cart page on mobile

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have added translations for new strings, if necessary.
  • I have updated the documentation accordingly, if necessary.

@jimbo jimbo added the version: Minor This changeset includes functionality added in a backwards compatible manner. label Jan 12, 2021
@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Jan 12, 2021

Messages
📖

Associated JIRA tickets: PWA-1243.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

Generated by 🚫 dangerJS against 7ac84f1

sirugh
sirugh previously requested changes Jan 13, 2021
Copy link
Contributor

@sirugh sirugh left a comment

Choose a reason for hiding this comment

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

Going to need to re-think the global padding. Also, something seems off with the page width and the left nav height:

Image from Gyazo

@@ -12,7 +12,8 @@
.page {
margin: 0 auto;
max-width: var(--venia-global-maxWidth);
min-height: 100vh;
min-height: 40rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is much more palatable than 100vh :) Nice and simple.

@@ -12,7 +12,8 @@
.page {
margin: 0 auto;
max-width: var(--venia-global-maxWidth);
min-height: 100vh;
min-height: 40rem;
padding: 1rem 0 1.5rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this will work - some components are meant to fit snug against the header ie error page and the home page sample content. Notice the gap:

@fooman
Copy link
Contributor

fooman commented Jan 13, 2021

Bringing back the footer into view does cause quite a bit of jumping around on any pages that load content async like product and categories - https://pr-2942.pwa-venia.com/venia-tops/venia-blouses.html?page=1 which will affect Cumulative Layout Shift negatively https://web.dev/cls/

@jimbo
Copy link
Contributor Author

jimbo commented Jan 13, 2021

Bringing back the footer into view does cause quite a bit of jumping around on any pages that load content async like product and categories - https://pr-2942.pwa-venia.com/venia-tops/venia-blouses.html?page=1 which will affect Cumulative Layout Shift negatively https://web.dev/cls/

Yes, very good point. This highlights how problematic it is to async-load content without placeholders that allow layout to pre-allocate space for that content. Lighthouse does and should call this out, and we do need to address it.

@brendanfalkowski
Copy link
Contributor

Devil's advocate though — loading skeletons almost always have CLS too. They just never seem to be content-shaped enough to perfectly avoid it. Yeah Google wants you to avoid it, but can anyone without SSR? This just feels like one of those "a real project would never allocate resources to fixing it when the backlog has 200 tickets" areas.

@@ -10,9 +10,10 @@
}

.page {
display: grid;
Copy link
Contributor

@sirugh sirugh Jan 14, 2021

Choose a reason for hiding this comment

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

Causes issues on mobile for the CMS page. Also for cart page as the grid aligns center but then we have extra padding on the page itself. Do we need this attribute?

Image from Gyazo

@jimbo
Copy link
Contributor Author

jimbo commented Jan 25, 2021

Devil's advocate though — loading skeletons almost always have CLS too. They just never seem to be content-shaped enough to perfectly avoid it. Yeah Google wants you to avoid it, but can anyone without SSR? This just feels like one of those "a real project would never allocate resources to fixing it when the backlog has 200 tickets" areas.

That's true, but CLS measures how much layout shift, so even an imperfect skeleton is better than none.

That said, it's also true that layout shift will continue to be a problem until we land SSR. Because routing information is stored on the server rather than the client, we can't even render a meaningful skeleton until useMagentoRoute finishes its query, at which point rendering a skeleton is questionable.

Accordingly, I've stripped this PR down to the essential bugfix and nothing more.

@jimbo jimbo dismissed sirugh’s stale review January 29, 2021 17:26

Removed the offending line.

@dpatil-magento
Copy link
Contributor

@jimbo Looks good. Just a query when page content is very less, should there be max height?

image

@jimbo
Copy link
Contributor Author

jimbo commented Feb 2, 2021

@jimbo Looks good. Just a query when page content is very less, should there be max height?

Should be fine as it is.

@dpatil-magento
Copy link
Contributor

QA Approved.

@dpatil-magento dpatil-magento merged commit d73de18 into develop Feb 2, 2021
@dpatil-magento dpatil-magento deleted the jimbo/min-height branch February 2, 2021 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:venia-ui Progress: done version: Minor This changeset includes functionality added in a backwards compatible manner.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants