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

MWPW-157888 - Hero marquee w/ no-min-height and no l/r padding when using a full-width variant in masonry(repost) #2923

Open
wants to merge 7 commits into
base: stage
Choose a base branch
from

Conversation

ryanmparrish
Copy link
Contributor

@ryanmparrish ryanmparrish commented Sep 19, 2024

FYI: This a repost from reverted PR due to some issues seen w/ bg images not showing. Testing pages didn't have these examples initially so i've added em. Sorry for the bump. :)


As and author in a milo project using a [hero-marquee]

I want to use this block with out a minimal height so the block has a natural height based on content.
I want to use this block in a masonry grid w/ the variant full-width and not have the extra left/right padding seen in this scenario.
Example screenshot - Notice the block height is huge, the l/r padding is causing the block to go outside its bounds.

image

Fixed

Add a no-min-height variant to the hero-marquee.
Address padding issue on hero-block. Erroneously comes from the has-bg class being added.
Resolves: MWPW-157888

Test URLs:

Before: https://main--milo--adobecom.hlx.page/drafts/steenmeyer/hero-editorial-layout-pattern-examples/hero-editorial-no-min-height-masonry1?martech=off
After: https://rparrish-hero-bg-fix-2--milo--adobecom.hlx.page/drafts/steenmeyer/hero-editorial-layout-pattern-examples/hero-editorial-no-min-height-masonry1?martech=off

Hero in a section grid (masonry & -up)
Before: https://main--milo--adobecom.hlx.page/drafts/rparrish/grids/hero-grids?martech=off
After: https://rparrish-hero-bg-fix-2--milo--adobecom.hlx.page/drafts/rparrish/grids/hero-grids?martech=off

Hero Marquee (regression)
These should all look the same

@ryanmparrish ryanmparrish added the needs-verification PR requires E2E testing by a reviewer label Sep 19, 2024
@ryanmparrish ryanmparrish requested review from rgclayton and a team September 19, 2024 19:50
Copy link
Contributor

aem-code-sync bot commented Sep 19, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.20%. Comparing base (adf2a9c) to head (58b1f71).
Report is 14 commits behind head on stage.

Additional details and impacted files
@@            Coverage Diff             @@
##            stage    #2923      +/-   ##
==========================================
+ Coverage   96.23%   98.20%   +1.96%     
==========================================
  Files         236       65     -171     
  Lines       54254     7901   -46353     
==========================================
- Hits        52212     7759   -44453     
+ Misses       2042      142    -1900     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aem-code-sync aem-code-sync bot temporarily deployed to rparrish/hero-bg-fix-2 September 19, 2024 19:53 Inactive
Copy link
Contributor

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

libs/blocks/hero-marquee/hero-marquee.css Show resolved Hide resolved
@@ -132,6 +133,21 @@ function parseKeyString(str) {
return result;
}

function isElementEmpty(element) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's very likely I'm missing something, but couldn't we simply check for element.textContent.trim()? I'd assume that if there's some text anywhere, the element is not empty.

Copy link
Contributor Author

@ryanmparrish ryanmparrish Sep 24, 2024

Choose a reason for hiding this comment

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

@overmyheadandbody - Most of the time this row has a <picture> or <video> element and no textContent. This also uses per-viewport background cols that have similar conditions. That's why i've done the overly verbose conditions here, but lmk if you see a slimmer way to handle that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we know of these <picture> and <video> use-cases, couldn't we do something like

Suggested change
function isElementEmpty(element) {
return element.textContent.trim() && !element.querySelector('source, src');

Sorry if I'm a bit dense about this, this just seems more complicated than needed to me. If you have other reasons why this wouldn't work we can move forward with this.

Copy link
Contributor

@robert-bogos robert-bogos left a comment

Choose a reason for hiding this comment

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

Can we add some unit tests to have the codecov check pass?

@aem-code-sync aem-code-sync bot temporarily deployed to rparrish/hero-bg-fix-2 September 24, 2024 18:25 Inactive
Copy link
Contributor

@overmyheadandbody overmyheadandbody left a comment

Choose a reason for hiding this comment

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

Still some concerns about isElementEmpty. If the suggestion still doesn't work, we can leave it as-is for now

@@ -132,6 +133,21 @@ function parseKeyString(str) {
return result;
}

function isElementEmpty(element) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we know of these <picture> and <video> use-cases, couldn't we do something like

Suggested change
function isElementEmpty(element) {
return element.textContent.trim() && !element.querySelector('source, src');

Sorry if I'm a bit dense about this, this just seems more complicated than needed to me. If you have other reasons why this wouldn't work we can move forward with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-verification PR requires E2E testing by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants