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

Login form regression cause components outside of it to require two clicks to work #6667

Open
davidef opened this issue Sep 23, 2024 · 3 comments

Comments

@davidef
Copy link

davidef commented Sep 23, 2024

Description

Components added outside of a view which include a LoginForm require two click to be triggered.
This is a regression since 24.1.0. It was working as expected both in 24.0.x and 23.x.x

Expected outcome

A click on a link or button outside the LoginForm should be trigger the corresponding action at first click.

Minimal reproducible example

@Route(value = "login")
public class LoginView extends VerticalLayout {
	public LoginView() {
		LoginForm form = new LoginForm();
		add(form);

		RouterLink a = new RouterLink(OtherView.class);
		a.add("Privacy policy");
		add(a);
	}
}

Steps to reproduce

  1. Open the view
  2. Click on the link out side of the LoginForm (doesn't work)
  3. Click again (it now follow the link)

Environment

Vaadin version(s): 24.1.0 up to 24.4.12

Browsers

Issue is not browser related

@yuriy-fix yuriy-fix added bug Something isn't working vaadin-login Severity: Major Impact: Low a11y Accessibility issue regression and removed a11y Accessibility issue labels Sep 26, 2024
@web-padawan
Copy link
Member

web-padawan commented Sep 27, 2024

Confirmed also in the web component using the following code example:

<vaadin-login-form></vaadin-login-form>

<a href="example.com">Example</a>

<script type="module">
  import '@vaadin/login/vaadin-login-form.js';
</script>

This problem is caused by adding error messages for login fields in 24.1.0: vaadin/web-components#5836:

  1. Once the focus leaves the login form on link mousedown, the error message shows and the form height increases,
  2. As a result, on mouseup event the click is no longer on the link (but the empty space it) so it doesn't get activated.

One possible workaround is to set explicit height on the login form to ensure it doesn't auto-grow.

UPD: see also similar issue where showing error messages causes button clicks to not fire.

@web-padawan web-padawan self-assigned this Sep 30, 2024
@web-padawan
Copy link
Member

BTW, this also affects built-in logic e.g. in some cases "Forgot password" button can't be clicked if focus is in any of the fields (the visual "active" state is applied on mousedown but there is no forgot-password event fired).

I'll see if we can postpone setting errorMessage until the field focusout (or global click if mouse was used for blur).

@vursen
Copy link
Contributor

vursen commented Oct 18, 2024

Depends on vaadin/web-components#7902. For explanation, see: vaadin/web-components#7894 (comment)

@web-padawan web-padawan removed their assignment Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants