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 done
gfellerph opened this issue Oct 26, 2024 · 0 comments · May be fixed by #4030
Open
3 tasks done

[component]: Link area #3830

gfellerph opened this issue Oct 26, 2024 · 0 comments · May be fixed by #4030
Assignees
Labels
📦 components Related to the @swisspost/design-system-components package
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()).

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

Documentation

  • Areas should have hover styles

Props

  • selector: optional selector to target a link, 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
  • Prevent involuntary clicks by checking click target against selector if it's set

Component naming

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

Resources

openui/open-ui#1111

Tasks

💻 Tasks

Preview Give feedback
@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
@gfellerph gfellerph removed the needs: 🏓 dev roundtable To be discussed at the roundtable of esteemed developers label Nov 7, 2024
@veyaromain veyaromain self-assigned this Nov 13, 2024
@veyaromain veyaromain linked a pull request Nov 20, 2024 that will close this issue
@alizedebray alizedebray moved this from 👀 Triage to 🤬 Dev in review in Design System Production Board Nov 20, 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 Code Review
Development

Successfully merging a pull request may close this issue.

2 participants