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

sbb-chip-group: initial implementation #2761

Open
mcilurzo opened this issue Jun 14, 2024 · 1 comment
Open

sbb-chip-group: initial implementation #2761

mcilurzo opened this issue Jun 14, 2024 · 1 comment
Assignees
Labels
complexity: L Can be done in a fortnight proposal: accepted

Comments

@mcilurzo
Copy link
Contributor

mcilurzo commented Jun 14, 2024

Feature Description

We want to implement the sbb-chip-group component. It holds a list of sbb-chip that the user can add or remove.
It is mainly meant to be used inside an sbb-form-field, connected to an input.

Figma
Figma 2

Design Specification

  • The user can add new chips by typing and pressing the "enter" key;
  • Only one chip is focusable at any moment (generally the last one);
  • If the input is empty and the "delete" key is pressed, the last chip is focused;
  • Chips can be removed unless they are readonly or disabled
  • It should be possible to also connect an sbb-autocomplete to the same input element. When an option is selected, it should also add the corresponding sbb-chip (as if the user had pressed enter)
  • the sbb-chip-group is a flex container that wraps horizontally. The input should wrap with it which means that it needs to be the last child of the sbb-chip-container (ensure the consistency of the sbb-form-field logic and style)

Keyboard interaction

  • You can navigate chips through arrow keys;
  • Each chip has two navigation steps, one for the chip and the second for the delete button
  • If the input is focused (and empty), the 'detete' key moves the focus to the last chip;
  • If a chip is focused, the 'detete' key removes it;

Technical Specification

  • sbb-chip-container is a form-associated element
  • When the user adds a new chip, the sbb-chip-group creates a new sbb-chip and appends it to the Light DOM
  • the value is a get/set property that queries for non-disabled sbb-chip and returns an array of their values
  • sbb-chip-group optionally connects to an input through the for property. If possible, it connects automatically if in an sbb-form-field

A11y

Angular material uses

  • role="grid" for the container
  • role="row" for the chip
  • Two role="gridcell", one for the label container and one for the delete button

HTML Usage

<sbb-form-field>
  ...
  <sbb-chip-group name="...">
    <sbb-chip value="value">Label value</sbb-chip>
    <sbb-chip [disabled] [readonly]>Label</sbb-chip>
    ...
    <input />
  </sbb-chip-group>
</sbb-form-field>
@mcilurzo mcilurzo converted this from a draft issue Jun 14, 2024
@mcilurzo mcilurzo added this to the Release 2.0.0 milestone Jun 14, 2024
@DavideMininni-Fincons DavideMininni-Fincons self-assigned this Oct 8, 2024
@DavideMininni-Fincons DavideMininni-Fincons removed their assignment Oct 15, 2024
@TomMenga
Copy link
Contributor

TomMenga commented Nov 18, 2024

[WIP] Draft proposal:

  • Container name: sbb-chip-group, sbb-chips-set or sbb-chips-list;
  • sbb-chips is a form-associated element
  • sbb-chips connects to an input. May connect automatically if in a form-field
<sbb-form-field>
  ...
  <sbb-chips for="inputId" name="...">
    <sbb-chip>Label</sbb-chip>
    <sbb-chip [disabled] [readonly]>Label</sbb-chip>
  </sbb-chips>

  <input id="inputId" />
</sbb-form-field>

@kyubisation kyubisation removed this from the Release 2.0.0 milestone Nov 25, 2024
@kyubisation kyubisation added proposal: accepted complexity: L Can be done in a fortnight and removed proposal: open labels Dec 2, 2024
@TomMenga TomMenga changed the title Chip: dismissable variant sbb-chip-group: initial implementation Dec 11, 2024
@TomMenga TomMenga self-assigned this Dec 13, 2024
@TomMenga TomMenga moved this from Next to In progress in ESTA Web Lyne Design System Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: L Can be done in a fortnight proposal: accepted
Projects
Status: In progress
Development

No branches or pull requests

4 participants