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

Header CLS fixes, reduced styles and classes complexity #416

Merged
merged 8 commits into from
Jan 5, 2023

Conversation

Oksydan
Copy link
Contributor

@Oksydan Oksydan commented Dec 21, 2022

Questions Answers
Description? Reducing complexity and CLS caused by responsive component, changed BEM classes to stay one level deep instead of BLOCK__ELEMEMT__ELEMENT to just BLOCK_EMLEMENT.
Type? improvement
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #252.
How to test? play around
Possible impacts? no

It is first part of CLS fixes for header. Also we are reducing some complexity in styles and I would like to relay more on bootstrap components instead of reinventing the wheel with some extra unneeded styles.
It will not resolve whole issue but just some part of it. It will be easier to review code, provide feedback and explain changes if we split it into multiple PR-s.

We are right now showing preview of mobile block for the js loading time, there is no longer jumping stuff around on loading on mobile devices. We will be also making preload components in next stage of CLS fixes after this one will be reviewed and merged.

Comparison (Throttling 3G FAST):

BEFORE:

before.mov

AFTER:

after.mov

There is multiple changes to header structure and we could go even further with that header-top__right element and children inside but I didn't want to make this PR too big. I will be harder to review and make changes according to review.

.hidden-on-mobile and .hidden-on-desktop classes has been removed and blocks got proper class replacement for that.

One extra note: we shouldn't make more elements than just one in our BEM classes example:
.header__top__right - we got here way to deep, this class has been replaced by .header-top__right.
There is a lot of example when BEM can goes wrong https://scalablecss.com/bem-nesting-grandchild-elements/

Copy link
Contributor

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

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

Just a small comment but not blocking as it's not really related, as it's a WIP just ping me when it's ready for review 🚀

@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}

<div id="_desktop_search" class="order-2 ms-auto">
<div id="_desktop_search" class="order-2 ms-auto col-auto px-1 hidden-on-mobile">
Copy link
Contributor

Choose a reason for hiding this comment

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

We wanted to get rid of these hidden-on-* classes but seems like we forgot to remove them, to rely more on bootstrap classes as you specified in the description

@NeOMakinG
Copy link
Contributor

French-Croissants-SM-2363

And here is a croissant as a gift to make you motivated 🥐

😄

@Oksydan Oksydan changed the title [WIP] Header CLS fixes, reduced styles and classes complexity Header CLS fixes, reduced styles and classes complexity Jan 3, 2023
@Oksydan
Copy link
Contributor Author

Oksydan commented Jan 3, 2023

@NeOMakinG ready for CR

@Oksydan Oksydan requested a review from NeOMakinG January 3, 2023 22:33
NeOMakinG
NeOMakinG previously approved these changes Jan 4, 2023
Copy link
Contributor

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

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

Seems ok to me, except a little nitpick comment but 🍬

}

@include media-breakpoint-up(md) {
padding: $btn-padding-y $btn-padding-x;
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we don't have any CSS variables to consume there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @NeOMakinG for your review, changes applied.

NeOMakinG
NeOMakinG previously approved these changes Jan 5, 2023
@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 5, 2023

@Oksydan Igor could you please resolve the conflicts? I will merge it after 👍

@Oksydan
Copy link
Contributor Author

Oksydan commented Jan 5, 2023

@Hlavtox branch rebased

@Hlavtox Hlavtox merged commit 151ee29 into PrestaShop:develop Jan 5, 2023
@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 5, 2023

🚀🚀🚀

@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 7, 2023

Snímek obrazovky 2023-01-07 174123

@Oksydan Could you please check the sign in button bro? The name is not hiding and chrome is applying some useragent styles, because we removed btn and btn-link classes. Thank yooooou. 🙏

@Oksydan
Copy link
Contributor Author

Oksydan commented Jan 7, 2023

Whoops @Hlavtox. No QA :trollface:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize bundles sizes, add csso, fix lighthouse issues
3 participants