Skip to content

Update <post-menu> and <post-popovecontainer> to enforce separation of concerns #6341

@myrta2302

Description

@myrta2302

Based on #6042.

  • Enforce separation of concerns between the post-menu and the post-popovercontainer:
    → The post-popovercontainer should know about its own state and emit events when it changes.
    → The post-menu should only react to the events.
    → There should be an extra payload {first: boolean} in the post-popovercontainer events.
    → Instead of having a requestAnimationFrame in the post-menu, there should be a postToggled event in the post-popovercontainer

    The post-popovercontainer events would then be:

    • postShow Before content becomes visible (animation not started yet).
    • postShown After content is fully visible (animation ended).
    • postHide Before content starts hiding (animation not started yet).
    • postHidden After content is fully hidden (animation ended).
    • postToggle Before visibility is toggled (animation not started yet).
    • postToggled After visibility toggle is complete (animation ended).

And all these event would have a payload of type {first: boolean}.

  • addEventListener must be avoided whenever possible
    → The post-menu should react to the postRendered event with a onPostRendered update in the renderer
    → Same for the onPostToggle or onPostToggled

Metadata

Metadata

Assignees

Labels

📦 componentsRelated to the @swisspost/design-system-components package

Type

Projects

Status

🧐 In Review

Relationships

None yet

Development

No branches or pull requests

Issue actions