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]: Link area #3830

Open
3 tasks
gfellerph opened this issue Oct 26, 2024 · 0 comments
Open
3 tasks

[component]: Link area #3830

gfellerph opened this issue Oct 26, 2024 · 0 comments
Labels
📦 components Related to the @swisspost/design-system-components package needs: 🏓 dev roundtable To be discussed at the roundtable of esteemed developers
Milestone

Comments

@gfellerph
Copy link
Member

gfellerph commented Oct 26, 2024

Description

Create a web component that delegates clicks on it's area to the first slotted link. This solves a tricky accessibility issue where the link cannot wrap a card and cannot be reliably extended to the cards size via overlay. Optionally, the <post-linkarea> takes a selector to target a specific link. The only thing the component does then, is trigger a click on the link (slotted.querySelector('a').click()).

<div class="card">
  <post-linkarea>
      <img ... />
      <h2>Super product</h2>
      <p>Description...</p>
      <a href="/product-x" class="button">Buy product x</a>
  </post-linkarea>
</div>

Props

  • selector: optional selector to target a link (on the page, not only slotted into the component, default behaviour if not specified is to click on the first slotted link

Requirements

  • <post-linkarea> should use the pointer cursor to indicate a clickable area
  • this component is not focusable, keyboard focus should move to the real link instead. If the card needs outside focus styles, :has(:focus-visible) can be used to style the focus on the outer element

Component naming

  • post-linkarea
  • post-linkdelegate
  • post-clickdelegate
  • post-clickarea

Resources

openui/open-ui#1111

Tasks

💻 Tasks

@gfellerph gfellerph added the 📦 components Related to the @swisspost/design-system-components package label Oct 26, 2024
@gfellerph gfellerph added this to the Design v2 milestone Oct 26, 2024
@gfellerph gfellerph added the needs: 🏓 dev roundtable To be discussed at the roundtable of esteemed developers label Oct 27, 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 needs: 🏓 dev roundtable To be discussed at the roundtable of esteemed developers
Projects
Status: 👀 Triage
Development

No branches or pull requests

1 participant