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

feat(masthead): update simple megamenu #12108

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,19 @@ class C4DMastheadComposite extends HostListenerMixin(LitElement) {
const { heading } = megapanel;
const { viewAll, highlights } = menu;

const { title } = this.getL0Data()[_parentKey] || {};

return html`
<c4d-megamenu layout="${MEGAMENU_LAYOUT_SCHEME.LIST}">
${highlights
? html`
<c4d-megamenu-left-navigation>
${highlights.map((group, i) =>
this._renderMegapanelLinkGroup(group, {
headingLevel: 2,
autoid: `${c4dPrefix}--masthead__l0-nav-list${i}`,
})
)}
</c4d-megamenu-left-navigation>
`
: null}
<c4d-megamenu-left-navigation>
<span>${title}</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be a link? Also, have we considered if this should be a heading?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should not be a link, I considered a heading, but wasn't sure if that was the right semantics. Considering also adding aria-hidden to make this a presentation-only element.

Copy link
Contributor

@m4olivei m4olivei Nov 21, 2024

Choose a reason for hiding this comment

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

Right, on closer look that seems fine. Especially considering the <c4d-megamenu-right-navigation> can have an <h2> (see below). I mean, if design is saying that the repetition is useful for sighted users, it should follow that its useful for non-sighted users, so I'd avoid using aria-hidden.

Also we should probably add a part attribute to the <span>.

image

${highlights?.map((group, i) =>
this._renderMegapanelLinkGroup(group, {
headingLevel: 2,
autoid: `${c4dPrefix}--masthead__l0-nav-list${i}`,
})
)}
</c4d-megamenu-left-navigation>
<c4d-megamenu-right-navigation
style-scheme="${highlights
? MEGAMENU_RIGHT_NAVIGATION_STYLE_SCHEME.HAS_SIDEBAR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ $pos-btn-bottom: calc(
}
}

:host(#{$c4d-prefix}-megamenu-left-navigation) {
@include type-style(heading-04);
}

:host(#{$c4d-prefix}-megamenu[layout='tab']) {
::slotted(#{$c4d-prefix}-megamenu-left-navigation) {
display: flex;
Expand Down
Loading