Page MenuHomePhabricator

[Radio] Inconsistent display of default selected state
Closed, InvalidPublicBUG REPORT

Description

List of steps to reproduce:

Click on:

Radio button component on different browsers.

What happens?:
  • Google 102 and Firefox 101: the default selected state appears as the focus selected state.

Captura de Pantalla 2022-06-23 a las 10.16.12.png (294×974 px, 121 KB)

  • Safari 15.1: the default selected state shows up correctly.

Captura de Pantalla 2022-06-23 a las 10.17.09.png (166×498 px, 45 KB)

What should have happened instead?:

The default selected state should be the same on all browsers.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

The following is a recording of both browsers, one after the other.

Video Recording

Event Timeline

hi @EUdoh-WMF

From my understanding, the Firefox and Chrome are actually correct and the safari one is wrong.

When you click on a radio button, the input is actually "focused" so it will show the focus/selected state. If you click away from the radio then this will show the default selected that safari is currently showing.

Impact:

  • Is this impacting anyone who is using Codex currently?
    • Potentially Growth is using this? Not sure. @DAbad to follow-up
  • What components, if any, are impacted?
    • TAHS is NOT impacted
  • Is this blocking something?

@Sarai-WMDE @bmartinezcalvo Any chance you can clarify if my comment above is correct please and what do you expect to be the behaviour when the radio is clicked.

I have investigated this further and can confirm that the issue raised here is expected on Safari and it is a duplicate of the this story: https://phabricator.wikimedia.org/T310394

Summary: Safary does NOT emit Focus event on input fields. I have investigated and can confirm that this is also happening for <inout type="radio" />

@Sarai-WMDE @bmartinezcalvo Any chance you can clarify if my comment above is correct please and what do you expect to be the behaviour when the radio is clicked.

@SimoneThisDot right, our current implementation in Codex in all our components is that when you click in some component this component shows the focus state. We can find this behavior in all our clickable components, such as buttons or checkbox:

Captura de Pantalla 2022-06-23 a las 10.44.03.png (126×244 px, 20 KB)
Captura de Pantalla 2022-06-23 a las 10.44.47.png (140×374 px, 28 KB)

I think this is the right and logical behavior for our radio buttons too.

Problem

The problem with our radio buttons is that the selected state paints the entire radio bg in blue and as the focus is blue too, we need to paint the focus-selected inside the circle border instead of around the border (as we do in the focus-default state).

Captura de Pantalla 2022-06-23 a las 10.48.44.png (616×768 px, 168 KB)

Solution

I think the solution here would be to redesign our radio selected states painting the circle inside the radio instead of the entire radio bg. With this solution we could have the same focus with 2px border in both focus-selected and focus-default states.

Captura de Pantalla 2022-06-23 a las 10.49.37.png (616×822 px, 175 KB)


I would do the following:

  1. Implement the Codex demo with the default-selected showing the focus-selected state
  2. Create a new task to update our selected radios with this new solution explained above

What do you think?

@SimoneThisDot @EUdoh-WMF apart from the default selected state, I've detected that the active state is wrong implemented in Codex since it doesn't match our Figma spec sheet so I've created this new task T311209 to fix it.

Captura de Pantalla 2022-06-23 a las 10.41.04.png (484×1 px, 528 KB)

Catrope subscribed.

I can't reproduce this anymore, maybe this fixed itself through one of the other Radio changes we made recently.