Tano
Tano

Reputation: 3910

Vaadin double click and browser behavior

I'm developing a Vaadin application (with version 6.8.10) with a tree component. We need to react to item's double clicks. But in our cross-browser tests we founded that the double-click doesn't work always in Firefox (some times works).

Here our eventListener code:

 @Override
  public void itemClick(ItemClickEvent event) {
  *  if (event.isDoubleClick()) {  // Breakpoint line
       // our action
    }
  } 

Debugging in Eclipse we received following values (in each browser after a double click Vaadin receives 2 events)

Chrome

1° event received

event.getButton() ==> 1

event.isDoubleClick() ==> false

event.getButtonName() ==> left

2° event received

event.getButton() ==> 1

event.isDoubleClick() ==> true

event.getButtonName() ==> left

Firefox

1° event received

event.getButton() ==> 1

event.isDoubleClick() ==> false

event.getButtonName() ==> left

2° event received

event.getButton() ==> 1

event.isDoubleClick() ==> false

event.getButtonName() ==> left

Resuming, in Firefox my double-click are detected as 2 single clicks!!!!

Are you experienced something similar? Do you have a workaround?

Thanks!

Upvotes: 1

Views: 3916

Answers (1)

Tano
Tano

Reputation: 3910

SOLVED!!

We saw that there is an old Ticket (#8384) on Vaadin Forum who describes this behavior.

The proposed solution was to setImmediate(false) on the tree object, but we wanted to leave our code cleaner and we decided to remove the line setImmediate() from the code. We tested that new Tree().isImmediate() == false (as default), so it should work.

After a lot of testing, research and debugging... I decided to actually write setImmediate(false) im our code (it should be not necessary) and magically now, our code works fine in Firefox!!!

I hope this will be helpful to someone.

Upvotes: 2

Related Questions