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

vaadin-radio-button can be slected/checked accidentally #442

Closed
RoProg opened this issue May 11, 2021 · 3 comments · Fixed by vaadin/vaadin-radio-button#230
Closed

vaadin-radio-button can be slected/checked accidentally #442

RoProg opened this issue May 11, 2021 · 3 comments · Fixed by vaadin/vaadin-radio-button#230
Assignees
Labels
BFP Bug fix prioritised by a customer Impact: High UX User experience issue V14 only Issue is only valid for Vaadin 14 vaadin-radio-button

Comments

@RoProg
Copy link

RoProg commented May 11, 2021

Tested on windows and android (touch) devices using this demo site:
https://vaadin.com/components/vaadin-radio-button/html-examples

Reproduction:

  1. Click on a not selected/checked radio-button and move the mouse cursor to some empty space while holding the mouse button.
  2. Release the mouse button.
  3. The radio-button will be selected.

It is also reproducible on touch screens.

This behavior leads to unwanted radio-button selections while scrolling or swiping on mobile devices.

@vlukashov
Copy link

Example on a touch screen (mobile):
https://user-images.githubusercontent.com/22416150/118711558-65bcb280-b828-11eb-9555-b1a1ba9cb5c1.mp4

Note that scrolling changes the selection, which is an unexpected UX. Native radio buttons do not do that.

@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-radio-button May 19, 2021
@RoProg
Copy link
Author

RoProg commented May 19, 2021

I fixed it for my project temporarily by replacing the following code (in vaadin-radio-button.js)

this._addEventListenerToNode(this, 'up', (e) => {
  this.removeAttribute('active'); 

  if (!this.checked && !this.disabled) {
     // If you change this block, please test manually that radio-button and
    // radio-group still works ok on iOS 12/13 and up as it may cause
    // an issue that is not possible to test programmatically.
    // See: https://github.com/vaadin/vaadin-radio-button/issues/140
    this.click();
  }
});

with

let isIOS = (/iPad|iPhone|iPod/.test(navigator.platform) ||
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) &&
!window.MSStream;

this._addEventListenerToNode(this, 'up', (e) => {
  this.removeAttribute('active');

  if (!this.checked && !this.disabled) {
    // If you change this block, please test manually that radio-button and
    // radio-group still works ok on iOS 12/13 and up as it may cause
    // an issue that is not possible to test programmatically.
    // See: https://github.com/vaadin/vaadin-radio-button/issues/140
    if(isIOS){
      this.click();
    }
  }
});

@vlukashov vlukashov added UX User experience issue and removed UX finding labels May 19, 2021
@web-padawan web-padawan added V14 only Issue is only valid for Vaadin 14 and removed enhancement New feature or request labels Jan 7, 2022
@web-padawan
Copy link
Member

In Vaadin 22 we refactored related code so this should not be a problem anymore. Vaadin 14 is still affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFP Bug fix prioritised by a customer Impact: High UX User experience issue V14 only Issue is only valid for Vaadin 14 vaadin-radio-button
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants