Bug 836066

Summary: right click opens browser native context menu instead of application's
Product: Red Hat Enterprise Virtualization Manager Reporter: Itamar Heim <iheim>
Component: ovirt-engine-webadmin-portalAssignee: Shahar Havivi <shavivi>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Stehlik <pstehlik>
Severity: unspecified Docs Contact:
Priority: high    
Version: unspecifiedCC: derez, dyasny, ecohen, iheim, Rhev-m-bugs, sgrinber, vszocs, ykaul
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: ux
Fixed In Version: si18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 20:06:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
right-click none

Description Itamar Heim 2012-06-28 02:53:34 UTC
sample scenario:
when i click hosts main tab.
if i right click on a host before the subtab appears i get the normal 
browser context menu rather than the application one.

Comment 1 Itamar Heim 2012-06-28 02:57:50 UTC
vojtech commented:
> Right-clicking unselected grid item causes the default browser context menu to > appear.
> Right-clicking selected grid item shows the application context menu.
> I suspect this is a bug in AbstractActionTable/AbstractActionPanel right-click > handler registration.

Vojtech, I see two bugs:
1. right clicking on "empty" areas of the grid - always reproduces the issue.
2. right clicking on a 'host' quickly after selecting the hosts tab will also reproduce this issue, even though the host is selected.
(I'd attach a screenshot, but hitting print-screen causes the context menu to disapper...)

Comment 2 Shahar Havivi 2012-09-03 14:49:52 UTC
I can reproduce it in google chrome but not in Firefox.
its look like chrome bug???

I did send a patch that override the normal right click context menu.

any other ideas?

Comment 3 Shahar Havivi 2012-09-03 14:50:18 UTC
posted at: http://gerrit.ovirt.org/#/c/7716/

Comment 4 Itamar Heim 2012-09-03 15:54:21 UTC
reproduced easily (for #1) on 3.1.0-14.el6ev with firefox 12 and IE 8

Comment 5 Shahar Havivi 2012-09-03 20:03:33 UTC
(In reply to comment #4)
> reproduced easily (for #1) on 3.1.0-14.el6ev with firefox 12 and IE 8
I didn't put it right...
It is reproducible in all browsers since its the context menu and we don't handle every widget right click context menu - my patch fix that.

the problem that I encounter (after applying my patch) in chrome is when first clicking on the main grid such as Hosts, the first click will always popup the native chrome context menu and the second is the grid widget context menu.

its look like only for the main grid (not the sub tab grids) and not for the tree so its a local bug? (and again google chrome only).

Comment 6 Daniel Erez 2012-09-05 12:39:44 UTC
What about VNC dialog? Copying connection information is done through browser's native context menu. Additionally, we might want text copy ability on some other dialogs.

Comment 7 Daniel Erez 2012-09-05 12:50:44 UTC
What about VNC dialog? Copying connection information is done through browser's native context menu. Additionally, we might want text copy ability on some other dialogs.

Comment 8 Vojtech Szocs 2012-09-05 14:45:32 UTC
I'm able to reproduce both issues as reported by Itamar.

Issue #1 - caused by the actual table (AbstractActionTable.table field) not filling up remaining space ("empty area") vertically. This could be fixed with CSS.

Issue #2 - able to reproduce it also in Users main grid. Will investigate and compare with Shahar's patch.

Comment 9 Vojtech Szocs 2012-09-05 14:47:59 UTC
Exact steps to reproduce issue #2: click outside Users tab, then click Users tab, first right-click on *each* row will produce browser-default context-menu, instead of application context-menu.

Comment 10 Vojtech Szocs 2012-09-05 14:54:32 UTC
There are two methods related to table context-menu:

1. AbstractActionPanel.addContextMenuHandler() for "contextmenu" JS event, which might not be called for first right-click (not sure why)
2. AbstractActionTable.table cell preview handler (AbstractActionTable:261) that is always called, and takes care of selecting given row, for "mousedown" (right button) JS event

A quick fix would be to move logic from method 1. to method 2. for AbstractActionTable, as the second method is always called. Need to investigate why the 1st one is not called sometimes on first right-click.

Comment 11 Vojtech Szocs 2012-09-05 16:44:24 UTC
Seems that before a row is selected through table selection model, it doesn't receive "contextmenu" JS events (method 1. above is not called). That's the reason why the row gets selected (method 2. above), but without application context-menu being shown (method 1. above).

IIUC this might indicate that row selection involes some additional DOM operations on the selected row. This also indicates that this issue is related to HasData widgets (e.g. CellTable within AbstractActionTable) only.

Suggested solution: use CellPreviewEvent/mousedown, in favor of ContextMenuEvent/contextmenu, for HasData widgets. If this works, I'll update the patch for review.

Comment 12 Vojtech Szocs 2012-09-06 12:16:26 UTC
Issue #2 fixed, issue #1 shouldn't take too long, I'll update the patch shortly after that.

Comment 13 Vojtech Szocs 2012-09-06 12:25:57 UTC
Working solution based on "contextmenu" event after all, "mousedown" is not reliable/consistent accross different browsers/platforms.

For example, FF/Win opens context menu AFTER releasing mouse button, FF/Linux opens context menu BEFORE releasing mouse button.

Comment 14 Vojtech Szocs 2012-09-06 13:30:23 UTC
New patch for both issues submitted upstream: http://gerrit.ovirt.org/7820

Shahar, can you please review/verify?

Comment 15 Shahar Havivi 2012-09-06 14:07:04 UTC
(In reply to comment #14)
> New patch for both issues submitted upstream: http://gerrit.ovirt.org/7820
> 
> Shahar, can you please review/verify?
Yes its working fine,
Thanks for your help!

Comment 16 Vojtech Szocs 2012-09-06 14:16:37 UTC
You are welcome, thanks for your quick response. Daniel/Shahar, can you also review the code?

(Shahar, if you agree, we could merge gerrit#7820 upstream/downstream, in favor of the original patch gerrit#7716)

Comment 17 Shahar Havivi 2012-09-06 14:47:29 UTC
(In reply to comment #16)
> You are welcome, thanks for your quick response. Daniel/Shahar, can you also
> review the code?
just +1 (forgot when I verify it...)

> 
> (Shahar, if you agree, we could merge gerrit#7820 upstream/downstream, in
> favor of the original patch gerrit#7716)
fine with me

Comment 18 Vojtech Szocs 2012-09-06 14:55:41 UTC
Thank you Shahar.

Itamar/Yaniv/Einav, can you please give acks (+) if this is to be included in 3.1.0?

Comment 19 Vojtech Szocs 2012-09-10 09:57:43 UTC
Patch merged upstream: http://gerrit.ovirt.org/7820

Comment 20 Vojtech Szocs 2012-09-10 10:01:32 UTC
Patch submitted downstream: https://gerrit.eng.lab.tlv.redhat.com/1989

Comment 21 Vojtech Szocs 2012-09-10 12:39:16 UTC
Patch merged downstream

Comment 22 Einav Cohen 2012-09-12 14:51:48 UTC
(In reply to comment #1)
> 1. right clicking on "empty" areas of the grid - always reproduces the issue.

This one is solved.

> 2. right clicking on a 'host' quickly after selecting the hosts tab will
> also reproduce this issue, even though the host is selected.
> (I'd attach a screenshot, but hitting print-screen causes the context menu
> to disapper...)

This one is trickier and less interesting, I think. If critical, open a separate BZ (not sure will be fixed for 3.1 though).

Comment 23 Einav Cohen 2012-09-12 15:07:12 UTC
For QA: Note that the browser's default context menu is still being opened in some scenarios (e.g. clicking in the "General" sub-tab area), which is fine since it is critical for tasks such as "copy (to clipboard)").

Comment 24 Vojtech Szocs 2012-09-12 16:04:20 UTC
> 2. right clicking on a 'host' quickly after selecting the hosts tab will
> also reproduce this issue, even though the host is selected.
> (I'd attach a screenshot, but hitting print-screen causes the context menu
> to disapper...)

Did anyone try to reproduce this issue, is it still relevant? (I wasn't able to reproduce it after applying above mentioned patch.)

Comment 25 Pavel Stehlik 2012-09-14 12:08:04 UTC
Created attachment 612827 [details]
right-click

Worth a thousand words - see the att. video.
I's still the same as Itamar reported. FF15, F17.

Repro:
Left click on the VM tab, then right click on VM row. Each 1st attempt shows FF menu instead RHEVM.

Comment 26 Einav Cohen 2012-09-25 05:39:18 UTC
(In reply to comment #25)
> Created attachment 612827 [details]
> right-click
> 
> Worth a thousand words - see the att. video.
> I's still the same as Itamar reported. FF15, F17.
> 
> Repro:
> Left click on the VM tab, then right click on VM row. Each 1st attempt shows
> FF menu instead RHEVM.

Vojtech - I also managed to reproduce it (on latest downstream) - you have to left-click an item, and *really quickly* afterwards right-click it ("really quickly": like double-click, only with different mouse buttons...).
I am using FF12 on F16.

I am moving this to ON_QA, as this bug is actually solved as of si18. 
QA: Comment #22 needs to be taken into consideration when verifying - scenario 2 is not solved. Please attempt to verify only scenario 1. 
Also look in Comment #23.