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

[component]: Menu #1242

Open
Tracked by #3207 ...
gfellerph opened this issue Mar 10, 2023 Discussed in #1208 · 0 comments · May be fixed by #3795
Open
Tracked by #3207 ...

[component]: Menu #1242

gfellerph opened this issue Mar 10, 2023 Discussed in #1208 · 0 comments · May be fixed by #3795
Assignees
Labels
📦 components Related to the @swisspost/design-system-components package

Comments

@gfellerph
Copy link
Member

gfellerph commented Mar 10, 2023

Discussed in #1208

Originally posted by gfellerph February 24, 2023
Create an action menu button. This button shows a dropdown with a list of links on click and offers various ways to browse that list.

Requirement URL
Accessibility https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/examples/menu-button-actions-active-descendant/
Design https://www.figma.com/design/JIT5AdGYqv6bDRpfBPV8XR/Foundations-%26-Components-Next-Level?node-id=21-167&t=pD7d0x3Fmz7ALkgq-0
Existing implementation Internet Header Language Switch on Desktop
https://next.design-system.post.ch/?path=/story/components-internet-header-header--default (does not fulfill accessibility requirements)
Other examples https://component.gallery/components/dropdown-menu/
Disambiguation with Select and Split Button #1888

Proposed API

Following the headless-ui listbox example, a third component is used for rendering the links. This gives control over the links back to the library authors.

<post-menu-toggle>
  <button class="btn btn-primary">Trigger</button>
</post-menu-toggle>
<post-menu>
  <h3>Title</h3>
  <post-menu-item href="/">
    <post-icon name="3123" />
    Link 1
  </post-menu-item>
  <post-menu-item>Button 1</post-menu-item>
  <hr />
  <post-menu-item>Button 2</post-menu-item>
</post-menu>
  • <post-menu> dropdown container that internally uses <post-popovercontainer> with role="menu"
  • <post-menu-toggle> wrapper for a toggle button

Behavior

  • The dropdown list should never be hidden by page boundaries. If the action menu button is placed directly at the edge of the screen, the dropdown list should adapt its alignment. Default alignment is bottom left (use post-popovercontainer)
  • There might be content before or after the link list
  • There might be cateogries of links or grouped link lists
  • Custom <a> and <button> or other form elements for filtering/decorating are also valid descendants, <post-menu-item> has just specific styles
  • Focus should move from the trigger buttons to the menu items (all focusable items in the menu) by pressing arrow keys (maybe https://github.com/gfellerph/focusgroup-polyfill could be used)
  • Focus should move back to trigger when menu closes
  • Escape should close the menu

Examples of possible use cases

Language switch
image

Breadcrumbs on mobile
image

Login widget
image

@gfellerph gfellerph added 📦 components Related to the @swisspost/design-system-components package 🍀 decision Marks conversations where a decision has been made and removed 🍀 decision Marks conversations where a decision has been made labels Mar 10, 2023
@gfellerph gfellerph added this to the Web Components milestone Mar 10, 2023
@github-actions github-actions bot added the stale label Aug 24, 2023
@gfellerph gfellerph removed the stale label Aug 24, 2023
@github-actions github-actions bot added the stale label Feb 14, 2024
@gfellerph gfellerph removed the stale label Feb 16, 2024
@github-actions github-actions bot added the stale label May 16, 2024
@gfellerph gfellerph added 💭 draft Issue is not ready for development and removed stale labels Jul 2, 2024
@gfellerph gfellerph added the 🦌 fair game This issue can potentially be closed because it no longer fits into the ecosystem label Jul 15, 2024
@gfellerph gfellerph changed the title Action menu button component [component]: Menu button Jul 25, 2024
@gfellerph gfellerph removed 💭 draft Issue is not ready for development 🦌 fair game This issue can potentially be closed because it no longer fits into the ecosystem labels Jul 25, 2024
@gfellerph gfellerph added the needs: design This issue needs a design in figma before it can be implemented. label Jul 25, 2024
@gfellerph gfellerph removed the needs: design This issue needs a design in figma before it can be implemented. label Jul 25, 2024
@gfellerph gfellerph changed the title [component]: Menu button [component]: Menu Aug 15, 2024
@gfellerph gfellerph modified the milestones: Design v2, Cargo Components Oct 1, 2024
@bashirkarimi bashirkarimi self-assigned this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 components Related to the @swisspost/design-system-components package
Projects
Status: 🤬 Dev in review
3 participants