vaadin / vaadin/framework

Doubleclick on buttons may open window twice

Open
#11,853 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

In vaadin 8.9.2 I have a button that opens a window as a modal dialog. After the window is opened no interaction with the view behind the window is possible,

However when clicking the button very fast the server is getting two events before the window is opened. This leads to two windows wich may irritate the user or even may cause exceptions in the application.

It could be reproduces with every browser, to reproduce the bug it might be easier to slow down the creation of the window or use debugger. But it also happens in real productive applications.

When opening a modal window I expect that even clicking ultra-fast will always lead to exactly one window.

I think the second event should be blocked when there is already a window opened that is not the parent of the clicked button. That means:

  1. if the recursive parent of the click-source (button) is the UI there must be no window
  2. if the recursive parent of the click-source is a window, it must be the window in front of all others.

I discussed this solution with @OlliTietavainenVaadin in expert chat as a workaround we might integrate in our code. But it a bit hacky because the contract of UI#getWindows() does not say anything about the order of the windows and I can only guess that the latest one is the window in front. I am also convinced that it is not the expected behavior of framework.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Vaadin 8.9.2 by rapidly clicking a button that opens a modal window, slowing window creation if needed. Start by examining click handling and UI#getWindows(), then verify that repeated clicks create exactly one window while clicks from the frontmost window continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.