Skip to content

refactor!: make radio-group use new mixins - #2641

Merged
web-padawan merged 21 commits into
masterfrom
refactor/radio-group
Sep 30, 2021
Merged

web-padawan merged 21 commits into
masterfrom
refactor/radio-group

Conversation

@vursen

@vursen vursen commented Sep 27, 2021 •

Copy link
Copy Markdown
Contributor

Description

The PR re-implements <vaadin-radio-group> to use the new mixins taking the radio-group a11y prototype as a starting point.

  • Re-implement <vaadin-radio-group> to use the new mixins.
  • Adapt the Lumo theme and corresponding visual tests.
  • Adapt the Material theme and corresponding visual tests.
  • Make the <vaadin-radio-button> unit tests pass.
  • Make the <vaadin-overlay unit tests pass.

Type of change

  • Breaking change

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@vursen
vursen force-pushed the refactor/radio-group branch 6 times, most recently from cca2d8d to 90dd10b Compare September 29, 2021 14:17
@vursen vursen changed the title refactor!: make radio-group use new mixins (WIP) refactor!: make radio-group use new mixins Sep 30, 2021

var nextButton = element.nextElementSibling || this.firstElementChild;
__selectIncRadioButton(index, step) {
const newIndex = (this.__radioButtons.length + index + step) % this.__radioButtons.length;

@vursen vursen Sep 30, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous approach with nextElementSibling/ prevElementSibling was based on an assumption that the group contains only radio buttons as children. Now, there are also the slotted helper, label, and error message, so I had to come up with a different solution.

@vursen
vursen requested a review from web-padawan September 30, 2021 06:30
@vursen
vursen marked this pull request as ready for review September 30, 2021 06:30
@vursen
vursen force-pushed the refactor/radio-group branch from 9cf31e7 to 4d337ed Compare September 30, 2021 09:13
@tomivirkki

Copy link
Copy Markdown
Member

For some reason, it's sometimes hard to get a radio selected

radio-issue.mp4

@vursen

vursen commented Sep 30, 2021 •

Copy link
Copy Markdown
Contributor Author

For some reason, it's sometimes hard to get a radio selected

It seems that the active attribute is set when you click in any place of the button, while the radio becomes checked only when you hit the label or input.

The previous implementation was based on handling the click event on the radio-button: once you click on the component, the radio becomes checked. The change event used to be fired manually.

The current implementation is based on handling the change event on <input type="radio"> so you need to click exactly at the input or label to get the radio-button checked.

I wonder what would be the right work-around here.

  1. Prevent adding active attribute when not hitting the label or input. Note, the native radio-button allows you to switch it only by clicking on the label or input.
  2. Enhance the clickable area for the input and label to make the button switchable over the whole area. It will most likely cause some changes to the Lumo and Material themes.

@vursen

vursen commented Sep 30, 2021 •

Copy link
Copy Markdown
Contributor Author

... although, the radio-button click area issues don't seem to be related to this PR and might be considered more as regressions of the radio-button, not the radio-group.

@vursen
vursen force-pushed the refactor/radio-group branch from cb34d34 to 1ecc263 Compare September 30, 2021 12:12
@vursen

vursen commented Sep 30, 2021 •

Copy link
Copy Markdown
Contributor Author

For some reason, it's sometimes hard to get a radio selected

Reported the issue regarding the clickable area of the radio-button: #2690

@vursen

vursen commented Sep 30, 2021 •

Copy link
Copy Markdown
Contributor Author

Reported the issue regarding the clickable area of the checkbox as it has the same problem: #2693

@vursen
vursen force-pushed the refactor/radio-group branch from 729320e to 76ffd85 Compare September 30, 2021 14:04
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vursen vursen added the a11y Accessibility issue label Sep 30, 2021
@vursen vursen self-assigned this Sep 30, 2021
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with platform 22.0.0.alpha7 and is also targeting the upcoming stable 22.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants