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: allow to include the navigation bar in a single line header #3539

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yopemu
Copy link

@yopemu yopemu commented Sep 11, 2024

Allow the option to include the navigation bar in a single line as a condensed header. Instead of 2 lines only one (the top one) will contains the logo, title and navigation bar, as well as the settings. As discussed with Debray Alize and Gfeller Philipp.

Team NES
Langhard Matthias
Pedroso Yohandris

Copy link

changeset-bot bot commented Sep 11, 2024

⚠️ No Changeset found

Latest commit: 8cf788d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Sep 11, 2024

Related Previews

@swisspost-bot
Copy link
Contributor

Related Previews
Preview URLs will be added here, once they are ready... loader

@yopemu
Copy link
Author

yopemu commented Sep 11, 2024

Hi @gfellerph as suggested, here is the direct PR

@gfellerph gfellerph added 💬 pattern discussion This issue will be discussed in the next Pattern Discussion meeting. labels Sep 11, 2024
@gfellerph
Copy link
Member

Resolution pattern discussion: thumbs up

@gfellerph gfellerph removed the 💬 pattern discussion This issue will be discussed in the next Pattern Discussion meeting. label Sep 24, 2024
@gfellerph gfellerph marked this pull request as ready for review September 26, 2024 12:57
@gfellerph gfellerph requested a review from a team as a code owner September 26, 2024 12:57
@gfellerph gfellerph self-requested a review September 26, 2024 12:57
Copy link

sonarcloud bot commented Sep 27, 2024

Copy link
Member

@gfellerph gfellerph left a comment

Choose a reason for hiding this comment

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

Thanks for doing the extensive rework necessary for providing this option and also thinking about documentation. The PR generally looks good, there are some things however that need to be fixed before we can merge it.

class="row justify-content-center top-navigation m-0 d-md-flex"
aria-label="navigation"
Copy link
Member

Choose a reason for hiding this comment

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

This causes screenreaders to announce "navigation navigation" as the <nav> already prompts a (localized) announcement of navigation. When adding this statically, there is also no chance to localize it.

Suggested change
aria-label="navigation"

@@ -2,32 +2,40 @@
<div class="nav-down">
<div class="intranet-header">
<div class="d-flex align-items-center flex-nowrap">
<div class="bg-logo d-sm-block">
<div id="logo" class="bg-logo d-sm-block">
Copy link
Member

Choose a reason for hiding this comment

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

Why was this id added? There is a chance of this id already being in use by a project, which could cause hard to find errors. If this id is necessary, we should prefix it with post- or an even more specific prefix. Otherwise, please remove it.

Same goes for the other instances where ids were added.


<nav
*ngIf="condenseHeader && hasNavbar"
aria-label="navigation"
Copy link
Member

Choose a reason for hiding this comment

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

This causes screenreaders to announce "navigation navigation" as the <nav> already prompts a (localized) announcement of navigation. When adding this statically, there is also no chance to localize it.

Suggested change
aria-label="navigation"

Comment on lines +348 to +364
private getAvailableNavWidth(): number {
if (!this.condenseHeader) {
return document.documentElement.scrollWidth;
}

const elements = [
this.logoElement,
this.titleElement,
this.optionHeaderContentElement,
this.profileMenuElement,
this.intranetSearchElement,
];
const totalWidth = elements.reduce((sum, element) => sum + (element?.scrollWidth || 0), 0);

return document.documentElement.scrollWidth - totalWidth;
}

Copy link
Member

Choose a reason for hiding this comment

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

Nice!

Copy link
Member

Choose a reason for hiding this comment

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

There's a one pixel gap around the logo, possibly caused by the nav items that are 2px bigger than the logo.

image

@gfellerph gfellerph added the v8 label Sep 27, 2024
@gfellerph gfellerph changed the base branch from main to changeset-release/release/v8 September 27, 2024 15:25
@gfellerph gfellerph changed the base branch from changeset-release/release/v8 to main September 27, 2024 15:25
@gfellerph gfellerph added the v9 label Sep 27, 2024
@gfellerph
Copy link
Member

Notice for @swisspost/design-system-maintainers, this PR needs to go to main and then needs a cherry pick to release/v8.

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

Successfully merging this pull request may close these issues.

3 participants