-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Using font size and spacing for mega menu hierarchy #1520
Changes from 8 commits
1363e42
7392c23
36f1113
0e44a65
2cf7a95
775c7c0
4d0d8a7
51defb6
60a31a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,7 +8,6 @@ | |||||
border-radius: 0; | ||||||
border-right: 0; | ||||||
left: 0; | ||||||
max-height: calc(100vh - var(--header-bottom-position-desktop, 20rem) - 4rem); | ||||||
overflow-y: auto; | ||||||
padding-bottom: 2.4rem; | ||||||
padding-top: 2.4rem; | ||||||
|
@@ -18,6 +17,10 @@ | |||||
z-index: -1; | ||||||
} | ||||||
|
||||||
.shopify-section-header-sticky .mega-menu__content { | ||||||
max-height: calc(100vh - var(--header-bottom-position-desktop, 20rem) - 4rem); | ||||||
} | ||||||
|
||||||
.header-wrapper--border-bottom .mega-menu__content { | ||||||
border-top: 0; | ||||||
} | ||||||
|
@@ -28,15 +31,8 @@ | |||||
} | ||||||
|
||||||
.mega-menu[open] .mega-menu__content { | ||||||
animation: animateMenuOpen var(--duration-default) ease; | ||||||
animation-fill-mode: forwards; | ||||||
} | ||||||
|
||||||
@media (prefers-reduced-motion) { | ||||||
.mega-menu[open] .mega-menu__content { | ||||||
opacity: 1; | ||||||
transform: translateY(0); | ||||||
} | ||||||
opacity: 1; | ||||||
transform: translateY(0); | ||||||
} | ||||||
|
||||||
.mega-menu__list { | ||||||
|
@@ -49,11 +45,21 @@ | |||||
.mega-menu__link { | ||||||
color: rgba(var(--color-foreground), 0.75); | ||||||
display: block; | ||||||
font-size: 1.2rem; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find this a little small 😬 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something is off here, from the original logic, they would be styled as L2s, not L3s when in presence of L2s and L3s There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to be clear: L3s that are alongside L2s should be styled like L2s when they have no children. Is that right? Actually this makes no sense... L2s that are alone should be styled like L2s that have children. I think that's what it should be, is that right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also find 1.2rem1.3remIt does lose some of the hierarchy, so I'm not sure if there's something we can do about it. I don't have the strongest opinion here, but just sharing my personal point of view as a user (very subjective :P). I find it kinda hard to read menus in Dawn and Studios on desktop when using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So should we be switching to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
To update based on UX recommendation to monitor and observe from different font perspective before decreasing the size smaller. Thanks! cc. @danielvan There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just made the commit - should be ready to test. |
||||||
line-height: calc(1 + 0.3 / var(--font-body-scale)); | ||||||
padding-bottom: 0.8rem; | ||||||
padding-top: 0.8rem; | ||||||
padding-bottom: 0.6rem; | ||||||
padding-top: 0.6rem; | ||||||
text-decoration: none; | ||||||
transition: text-decoration var(--duration-short) ease; | ||||||
word-wrap: break-word; | ||||||
} | ||||||
|
||||||
.mega-menu__link--level-2 { | ||||||
font-size: 1.4rem; | ||||||
} | ||||||
|
||||||
.mega-menu__link--level-2:not(:only-child) { | ||||||
margin-bottom: 0.8rem; | ||||||
} | ||||||
|
||||||
.header--top-center .mega-menu__list { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -431,7 +431,7 @@ | |
<ul class="mega-menu__list page-width{% if link.levels == 1 %} mega-menu__list--condensed{% endif %}" role="list"> | ||
{%- for childlink in link.links -%} | ||
<li> | ||
<a href="{{ childlink.url }}" class="mega-menu__link link font-body-bold{% if childlink.current %} mega-menu__link--active{% endif %}"{% if childlink.current %} aria-current="page"{% endif %}> | ||
<a href="{{ childlink.url }}" class="mega-menu__link mega-menu__link--level-2 link{% if childlink.current %} mega-menu__link--active{% endif %}"{% if childlink.current %} aria-current="page"{% endif %}> | ||
{{ childlink.title | escape }} | ||
</a> | ||
{%- if childlink.links != blank -%} | ||
|
@@ -618,6 +618,7 @@ | |
if (this.predictiveSearch && this.predictiveSearch.isOpen) return; | ||
|
||
if (scrollTop > this.currentScrollTop && scrollTop > this.headerBounds.bottom) { | ||
if (this.preventHide) return; | ||
ludoboludo marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the other effect, I say "issue" in the video but it isn't one. Is that the sticky header will stay stick until you close the submenu: video But since it's easy to close I don't see it being too much of an issue 🤔 Just sharing so we know all the behavioural changes with this. |
||
requestAnimationFrame(this.hide.bind(this)); | ||
} else if (scrollTop < this.currentScrollTop && scrollTop > this.headerBounds.bottom) { | ||
if (!this.preventReveal) { | ||
|
@@ -635,7 +636,6 @@ | |
requestAnimationFrame(this.reset.bind(this)); | ||
} | ||
|
||
|
||
this.currentScrollTop = scrollTop; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this so the mega-menu is still scrollable when opened via sticky header.
Otherwise, we wouldn't be able to see the bottom elements due to the
position: sticky
.Before:
31-05-iipgo-kavuc.mp4
After:
31-03-v0zlo-l1m9z.mp4
Does it address your concern above, @ludoboludo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't exactly my concern but good catch on that approach.
My concern was just that when the mega menu is taking the full space, the only way you can close it is by clicking somewhere in the header/the parent menu item.
And I know when I visit other website I sometimes tend to click somewhere else to dismiss a dropdown. But not a biggy 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! This is only when the mega menu will take the full height of the view space right - I am happy that we can click outside of the menu most of the time for mid range height menu