Page MenuHomePhabricator

FilterChip: implement interactive states
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

We need to implement the interactive states in the FilterChip component in order to make it editable when the user is adding/editing them within a FilterChipInput T343474: FilterChipInput: make the FilterChip editable. At the moment, the only interactive element in the chip is the remove's button, so we will need to implement the following missing states in the FilterChip:

  • hover
  • active
  • focus

User stories

  • As a user, I need to edit the FilterChipI'm adding in a FilterChipInput.

Known use cases

FilterChipInput - UserPreferences.gif (293×600 px, 595 KB)
There are there 2 FilterChipInputs in User's preferences. The first one is editable while the second one is not editable.

Previous implementations

Design spec

Open questions

  • When navigating with the keyboard, will both the chip and remove button be in focus? - No, we will keep the focus behavior similar to what's implemented in OOUI, where you can focus on the entire chip but not the button.

Acceptance criteria (or Done)

Design

  • Design the Figma spec sheet and add it in this task
  • Update the component in the Figma library. This step will be done by a DST member.

Code

  • Implement the component's updates in Codex

Event Timeline

@CCiufo-WMF since the states were previously added in the Figma spec, I'm moving this task to Needs Refinement so we can implement it when we have availability.

CCiufo-WMF triaged this task as Medium priority.Aug 8 2023, 4:13 PM
CCiufo-WMF set the point value for this task to 3.Aug 8 2023, 5:10 PM

This probably should not be completed until T343474 is ready to implement as well

Change 950040 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] FilterChip: Add interactive styles

https://gerrit.wikimedia.org/r/950040

@bmartinezcalvo This is ready for design review as well! FilterChip demo, FilterChipInput demo

This is what I have implemented:

  • For the FilterChip component, whether it is inside a FilterChipInput or not, when you navigate to it via the keyboard, the entire chip will get a focus outline instead of just the remove button. This matches up with what OOUI does - inside a FilterChipInput, when you use the keyboard to navigate to a chip and press enter, the chip is removed. There is no way to edit a chip via keyboard nav.
  • Inside a FilterChipInput, FilterChips will also get hover and active styles. These styles are only included for FilterChips inside the FilterChipInput since FilterChips outside of that cannot be clicked.

Please let me know what you think of this implementation, especially the first part. I didn't think it was intuitive (and maybe impossible) to tab first to the entire chip, then to its remove button, and I wanted to keep the interaction in line with the OOUI version (cc @Volker_E)

@AnneT thank you for preparing this. I've reviewed both the FilterChip and the FilterChipInput and I'm listing some corrections:

  1. At the moment, in the FilterChip demo it's just represented the focus state in the chip. Could we also include the hover and active states in the FilterChip demo? If the chip can receive focus, it should also be hoverable and active.
    Captura de pantalla 2023-08-18 a las 10.55.23.png (388×1 px, 36 KB)
  1. Also at the moment, just the FilterChip itself receives the focus (the focus on the remove button is missing). If this button receives hover and active states, it should also receive the focus one. There are 2 interactive elements within a FilterChip:
    • The FilterChip itself (so it should receive hover, active and focus states). When the focus is placed on the chip and you press Enter, the chip becomes text within the input to edit the chip's text.
    • The remove button within the chip (since it's an interactive button it should also receive hover, active and focus states). When the focus is placed on the remove button and you press Enter, the chip is removed.
      Captura de pantalla 2023-08-18 a las 10.57.59.png (394×1 px, 38 KB)
      I think the focus order within a FilterChipInput should be: Input --> Chip itself --> Remove button
  1. Regarding the position of the chip, when it's being edited the current behavior seems a bit confusing to me since when you are editing a chip in a middle position (e.g. the 2nd chip in a group of 3 chips), when you click on it to edit it the 2nd chip moves to the 3rd position and the 3rd chip moves to the 2nd (Option 1 in the examples below). What if we edit the chip always in the position where the chip is (Option 2 below)?
    Chip edition_ position.png (485×1 px, 24 KB)

Hey @bmartinezcalvo ,

  1. At the moment, in the FilterChip demo it's just represented the focus state in the chip. Could we also include the hover and active states in the FilterChip demo? If the chip can receive focus, it should also be hoverable and active.

I have moved all interactive styles to the FilterChip.vue file, so FilterChips will have these styles whether they are inside the FilterChipInput or not. I do think there is more to discuss here, so I've made this a topic for tomorrow's design/eng sync.

  1. Also at the moment, just the FilterChip itself receives the focus (the focus on the remove button is missing). If this button receives hover and active states, it should also receive the focus one. There are 2 interactive elements within a FilterChip:
    • The FilterChip itself (so it should receive hover, active and focus states). When the focus is placed on the chip and you press Enter, the chip becomes text within the input to edit the chip's text.
    • The remove button within the chip (since it's an interactive button it should also receive hover, active and focus states). When the focus is placed on the remove button and you press Enter, the chip is removed.
      Captura de pantalla 2023-08-18 a las 10.57.59.png (394×1 px, 38 KB)
      I think the focus order within a FilterChipInput should be: Input --> Chip itself --> Remove button

I think we should discuss the best keyboard navigation behavior; this is different from what OOUI and other examples I've seen do, and I think the accessibility features of FilterChip/FilterChipInput should inform the keyboard navigation behavior. Let's talk about this at the next design/eng sync as well.

  1. Regarding the position of the chip, when it's being edited the current behavior seems a bit confusing to me since when you are editing a chip in a middle position (e.g. the 2nd chip in a group of 3 chips), when you click on it to edit it the 2nd chip moves to the 3rd position and the 3rd chip moves to the 2nd (Option 1 in the examples below). What if we edit the chip always in the position where the chip is (Option 2 below)?

This would be nice but would take a lot of time and effort. If we want to do this in the future, I would recommend making a separate task.

We decided as a team to:

  • Keep the focus behavior similar to what's implemented in OOUI, where you can focus on the entire chip but not the button
  • To open a new task for UX improvements of the FilterChip/FilterChipInput, including editing in place or improving the editing experience

Change 950040 merged by jenkins-bot:

[design/codex@main] FilterChip: Add interactive styles

https://gerrit.wikimedia.org/r/950040

We decided as a team to:

  • Keep the focus behavior similar to what's implemented in OOUI, where you can focus on the entire chip but not the button
  • To open a new task for UX improvements of the FilterChip/FilterChipInput, including editing in place or improving the editing experience

@AnneT thank you, the interactive states in the FilterChip input look great.

Change 953351 had a related patch set uploaded (by Catrope; author: Catrope):

[mediawiki/core@master] Update Codex from v0.17.0 to v0.18.0

https://gerrit.wikimedia.org/r/953351

Change 953351 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.17.0 to v0.18.0

https://gerrit.wikimedia.org/r/953351