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(component): improve header overflow handling #4273

Merged
merged 16 commits into from
Jan 30, 2025

Conversation

alizedebray
Copy link
Contributor

No description provided.

@alizedebray alizedebray requested a review from a team as a code owner December 13, 2024 19:23
@alizedebray alizedebray linked an issue Dec 13, 2024 that may be closed by this pull request
@swisspost-bot
Copy link
Contributor

swisspost-bot commented Dec 13, 2024

Related Previews

Copy link

changeset-bot bot commented Dec 16, 2024

🦋 Changeset detected

Latest commit: 3f751b2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@swisspost/design-system-components Minor
@swisspost/design-system-components-angular-workspace Patch
@swisspost/design-system-components-react Minor
@swisspost/design-system-documentation Patch
@swisspost/design-system-components-angular Minor
@swisspost/design-system-nextjs-integration Patch
@swisspost/design-system-styles Minor
@swisspost/design-system-tokens Minor
@swisspost/design-system-intranet-header Minor
@swisspost/design-system-icons Minor
@swisspost/design-system-migrations Minor
@swisspost/design-system-styles-primeng Minor
@swisspost/internet-header Patch
@swisspost/design-system-intranet-header-workspace Patch
@swisspost/design-system-styles-primeng-workspace Patch
@swisspost/design-system-intranet-header-showcase Patch

Not sure what this means? Click here to learn what changesets are.

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

@alizedebray alizedebray marked this pull request as draft December 16, 2024 09:21
@alizedebray alizedebray marked this pull request as ready for review December 16, 2024 10:01
@alizedebray alizedebray requested a review from a team as a code owner December 16, 2024 10:01
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.

Generally looks nice, but noticed something strange if one element has a very long name
image

Copy link
Contributor

@oliverschuerch oliverschuerch left a comment

Choose a reason for hiding this comment

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

There is no changeset file.

Comment on lines +66 to +69
background: var(--post-core-color-brand-white);
padding: var(--post-core-dimension-16);
box-shadow: var(--post-core-elevation-5);
line-height: var(--post-core-line-height-100);
Copy link
Contributor

Choose a reason for hiding this comment

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

I once more recommend: Never use core- or semantic-tokens, but instead use hardcoded values for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

First time with me!
Can we discuss this? Currently the whole header is using semantic tokens and I would like to understand why you prefer raw values. Also, I would rather handle this in a separate ticket as it would involve a lot of changes not related to this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I didn't mean I told you this already in particular, but I keep telling it to everyone that uses something else than component tokens 😉
I've added a DEV Discussion in the daily chat.

Copy link
Contributor

Choose a reason for hiding this comment

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

Conclusion from our discussion during the todays daily meeting: Avoid using core tokens, instead use sass varialbes (or if avilable use component tokens).

Copy link
Contributor

Choose a reason for hiding this comment

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

By the way, most of these tokens could probably being replaced with utility tokens. Which would be ok for me.

@use '@swisspost/design-system-styles/core' as post;
@use '@swisspost/design-system-styles/functions/tokens';
@use '@swisspost/design-system-styles/mixins/utilities';

button {
  background: post.$white;
  padding: tokens.get('utility.padding.16', utilities.$post-spacing);
  box-shadow: tokens.get('utility.elevation.500', utilities.$post-elevation);
  line-height: tokens.get('utility.line-height.1', utilities.$ost-typo);
}

@gfellerph gfellerph removed their request for review January 8, 2025 15:44
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.

Little hard to show it but if I add a lot of links, I can't scroll to the end of the list, the two megadropdowns are hidden and it won't scroll any further.

image

Comment on lines +66 to +69
background: var(--post-core-color-brand-white);
padding: var(--post-core-dimension-16);
box-shadow: var(--post-core-elevation-5);
line-height: var(--post-core-line-height-100);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I didn't mean I told you this already in particular, but I keep telling it to everyone that uses something else than component tokens 😉
I've added a DEV Discussion in the daily chat.

Comment on lines +66 to +69
background: var(--post-core-color-brand-white);
padding: var(--post-core-dimension-16);
box-shadow: var(--post-core-elevation-5);
line-height: var(--post-core-line-height-100);
Copy link
Contributor

Choose a reason for hiding this comment

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

Conclusion from our discussion during the todays daily meeting: Avoid using core tokens, instead use sass varialbes (or if avilable use component tokens).

@alizedebray
Copy link
Contributor Author

@oliverschuerch can you also open a ticket for turning the CSS variables into Sass variables? They are used everywhere in the header, not particularly in this PR. It would be easier to do everything in one go!

@oliverschuerch
Copy link
Contributor

oliverschuerch commented Jan 27, 2025

@oliverschuerch can you also open a ticket for turning the CSS variables into Sass variables? They are used everywhere in the header, not particularly in this PR. It would be easier to do everything in one go!

There you go: #4530

Comment on lines +66 to +69
background: var(--post-core-color-brand-white);
padding: var(--post-core-dimension-16);
box-shadow: var(--post-core-elevation-5);
line-height: var(--post-core-line-height-100);
Copy link
Contributor

Choose a reason for hiding this comment

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

By the way, most of these tokens could probably being replaced with utility tokens. Which would be ok for me.

@use '@swisspost/design-system-styles/core' as post;
@use '@swisspost/design-system-styles/functions/tokens';
@use '@swisspost/design-system-styles/mixins/utilities';

button {
  background: post.$white;
  padding: tokens.get('utility.padding.16', utilities.$post-spacing);
  box-shadow: tokens.get('utility.elevation.500', utilities.$post-elevation);
  line-height: tokens.get('utility.line-height.1', utilities.$ost-typo);
}

@alizedebray
Copy link
Contributor Author

alizedebray commented Jan 27, 2025

@oliverschuerch That would be the best of both worlds! I added a link to your comment in the ticket you created.

Copy link
Contributor

@oliverschuerch oliverschuerch left a comment

Choose a reason for hiding this comment

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

PR should contain a changeset

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.

@alizedebray we should add extensive tests for this feature because the logic is quite complex. We can do this in a separate ticket.

@alizedebray alizedebray merged commit 395db6b into main Jan 30, 2025
@alizedebray alizedebray deleted the 4250-main-navigation-overflow branch January 30, 2025 08:07
gfellerph pushed a commit that referenced this pull request Feb 3, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @swisspost/[email protected]

### Major Changes

- Removed Bootstrap shadow utility classes from the Design System, as
the elevation classes are replacing them. (by
[@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

- Renamed elevation utility classes and SCSS variables to allow for more
variants in the future. (by [@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

### Minor Changes

- Removed `post-popovercontainer` from the `post-megadropdown` component
and added desktop animations with new slide-down and slide-up effects.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#4421](#4421))

### Patch Changes

- Made the following components hidden until fully loaded to prevent
flickering: `post-avatar`, `post-banner`, `post-breadcrumb`,
`post-breadcrumb-item`, `post-closebutton`, `post-collapsible-trigger`,
`post-footer`, `post-header`, `post-language-option`,
`post-language-switch`, `post-mainnavigation`, `post-megadropdown`,
`post-megadropdown-trigger`, `post-menu`, `post-menu-item`, and
`post-menu-trigger`. (by [@schaertim](https://github.com/schaertim) with
[#4544](#4544))

- Fixed z-indexes for header components to ensure proper stacking order.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#4421](#4421))

- Updated the styles for `.focus-ring` and added documentation. (by
[@alionazherdetska](https://github.com/alionazherdetska) with
[#4543](#4543))

## @swisspost/[email protected]

### Minor Changes

- Improved main navigation overflow display. (by
[@alizedebray](https://github.com/alizedebray) with
[#4273](#4273))

- Removed `post-popovercontainer` from the `post-megadropdown` component
and added desktop animations with new slide-down and slide-up effects.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#4421](#4421))

### Patch Changes

- Fixed header mobile menu behavior by trapping the focus within it when
opened as well as making it scrollable. (by
[@leagrdv](https://github.com/leagrdv) with
[#4395](#4395))
-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]



## @swisspost/[email protected]



## @swisspost/[email protected]



## @swisspost/[email protected]

### Major Changes

- Removed Bootstrap shadow utility classes from the Design System, as
the elevation classes are replacing them. (by
[@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

- Renamed elevation utility classes and SCSS variables to allow for more
variants in the future. (by [@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

### Minor Changes

- Updated the styles for `.focus-ring` and added documentation. (by
[@alionazherdetska](https://github.com/alionazherdetska) with
[#4543](#4543))

- Added duplicate icons in icons health report. (by
[@myrta2302](https://github.com/myrta2302) with
[#4528](#4528))

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

- Replaced `sessionData` and `address` properties in the sessionStorage
item `klp.widget.state`. If you're looking for this info, contact the
Swiss Post Design System Team! (by
[@oliverschuerch](https://github.com/oliverschuerch) with
[#4553](#4553))
-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
gfellerph pushed a commit that referenced this pull request Feb 4, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @swisspost/[email protected]

### Major Changes

- Removed the `.lh-base` utility class. (by
[@leagrdv](https://github.com/leagrdv) with
[#4360](#4360))

- Removed Bootstrap shadow utility classes from the Design System, as
the elevation classes are replacing them. (by
[@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

- Renamed elevation utility classes and SCSS variables to allow for more
variants in the future. (by [@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

### Minor Changes

- Removed `post-popovercontainer` from the `post-megadropdown` component
and added desktop animations with new slide-down and slide-up effects.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#4421](#4421))

- Removed deprecated `$displayX-weight` scss variables and font-weight
light (`.light`) utilities as the new Swiss Post font does not have a
300 weight version. (by [@leagrdv](https://github.com/leagrdv) with
[#4531](#4531))

### Patch Changes

- Made the following components hidden until fully loaded to prevent
flickering: `post-avatar`, `post-banner`, `post-breadcrumb`,
`post-breadcrumb-item`, `post-closebutton`, `post-collapsible-trigger`,
`post-footer`, `post-header`, `post-language-option`,
`post-language-switch`, `post-mainnavigation`, `post-megadropdown`,
`post-megadropdown-trigger`, `post-menu`, `post-menu-item`, and
`post-menu-trigger`. (by [@schaertim](https://github.com/schaertim) with
[#4544](#4544))

- Fixed z-indexes for header components to ensure proper stacking order.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#4421](#4421))

- Updated the styles for `.focus-ring` and added documentation. (by
[@alionazherdetska](https://github.com/alionazherdetska) with
[#4543](#4543))

- Fixed high contrast mode hover and focus styles for `post-avatar`
component in anchor and button contexts. (by
[@alionazherdetska](https://github.com/alionazherdetska) with
[#4338](#4338))

- Internalized Bootstrap text utilities into the Design System. (by
[@leagrdv](https://github.com/leagrdv) with
[#4360](#4360))

## @swisspost/[email protected]

### Minor Changes

- Improved main navigation overflow display. (by
[@alizedebray](https://github.com/alizedebray) with
[#4273](#4273))

- Removed `post-popovercontainer` from the `post-megadropdown` component
and added desktop animations with new slide-down and slide-up effects.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#4421](#4421))

- Added the `post-linkarea` component. (by
[@veyaromain](https://github.com/veyaromain) with
[#4030](#4030))

### Patch Changes

- Removed nav for `post-header` component causing blank space on scroll
for screens &lt;1025px. (by
[@alionazherdetska](https://github.com/alionazherdetska) with
[#4532](#4532))

- Added z-index to the `post-header` component to display it on top of
other contents. (by [@leagrdv](https://github.com/leagrdv) with
[#4367](#4367))

- Fixed header mobile menu behavior by trapping the focus within it when
opened as well as making it scrollable. (by
[@leagrdv](https://github.com/leagrdv) with
[#4395](#4395))

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

- Added a transform function to avoid unitless zero values for specific
token types (like `dimension`, etc.), which allows us to use these
tokens also in css `calc()` functions. Because `<number-token>`s are
always interpreted as `<number>`s or `<integer>`s, "unitless 0"
`<length>`s aren’t supported in calc().
Source: <https://drafts.csswg.org/css-values-3/#calc-type-checking> (by
[@oliverschuerch](https://github.com/oliverschuerch) with
[#4534](#4534))

## @swisspost/[email protected]



## @swisspost/[email protected]



## @swisspost/[email protected]

### Major Changes

- Removed Bootstrap shadow utility classes from the Design System, as
the elevation classes are replacing them. (by
[@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

- Renamed elevation utility classes and SCSS variables to allow for more
variants in the future. (by [@leagrdv](https://github.com/leagrdv) with
[#4361](#4361))

### Minor Changes

- Removed deprecated `$displayX-weight` scss variables and font-weight
light (`.light`) utilities as the new Swiss Post font does not have a
300 weight version. (by [@leagrdv](https://github.com/leagrdv) with
[#4531](#4531))

- Updated the styles for `.focus-ring` and added documentation. (by
[@alionazherdetska](https://github.com/alionazherdetska) with
[#4543](#4543))

- Added the `post-linkarea` component. (by
[@veyaromain](https://github.com/veyaromain) with
[#4030](#4030))

- Added duplicate icons in icons health report. (by
[@myrta2302](https://github.com/myrta2302) with
[#4528](#4528))

### Patch Changes

- Fixed the sizing of the technology and supported browser images on the
introduction page of the documentation. (by
[@schaertim](https://github.com/schaertim) with
[#4549](#4549))

- Internalized Bootstrap text utilities into the Design System. (by
[@leagrdv](https://github.com/leagrdv) with
[#4360](#4360))

- Added fake content on the header preview to show the sticky behaviour.
(by [@leagrdv](https://github.com/leagrdv) with
[#4367](#4367))

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

- Replaced `sessionData` and `address` properties in the sessionStorage
item `klp.widget.state`. If you're looking for this info, contact the
Swiss Post Design System Team! (by
[@oliverschuerch](https://github.com/oliverschuerch) with
[#4553](#4553))
-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

Main navigation overflow
4 participants