Bug 371265 - links in menus are persnickety (hard to hit)
Summary: links in menus are persnickety (hard to hit)
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Client (show other bugs)
Version: 0.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.5 RC1   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords: usability
: 375000 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-02-10 12:43 EST by Susan McCourt CLA
Modified: 2012-06-04 16:37 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2012-02-10 12:43:04 EST
we put anchor tags in dojo menus to get link behavior.

One problem with this is that you have to actually hit the link, you can't sloppily click on the edge of the menu item.  Yet the menu hover leads you to believe that you can.

I wonder if there's something simple we can do to have the regular menu behavior we are currently overriding do something like fake an event to invoke the link.  I'll bet fixing this would also fix bug 369469.  I'd like to look at it in RC2 and assess risk.  

It seems much more prominent now that the user menu has these links.
Comment 1 Susan McCourt CLA 2012-03-21 23:18:15 EDT
*** Bug 375000 has been marked as a duplicate of this bug. ***
Comment 2 Susan McCourt CLA 2012-04-19 16:10:23 EDT
do this after we are on dojo 1.7
Comment 3 Susan McCourt CLA 2012-05-18 15:29:56 EDT
moving out of 0.5M2 to 0.5 milestone until we have more specific buckets for future
Comment 4 Susan McCourt CLA 2012-06-04 15:58:24 EDT
I played around with simulating an anchor event when the dijit menu item is clicked.  It worked great on Chrome (gave you the right click, ctrl+click behavior on the menu item in addition to the link) but in FF the ctrl augmented clicks were ignored, and in IE, all clicks in the menu item behaved as if you had clicked without ctrl.  These differences made the fix "not worth it" but I wanted to record the technique here for future playing around, becuase it seemed promising.

On click of the menu, get the anchor and spoof an event:
var anchor = dojo.query("a", this.domNode)[0]; //$NON-NLS-0$
if (anchor && anchor !== evt.target) {
	// if the menu item, but not the anchor, is clicked simulate a click event on the anchor.
	// We can't dispatch the existing event because dispatching an event already in the tree
	// will throw DISPATCH_REQUEST_ERR : Number = 1
	// So we create an identical event.
	var clickEvent = window.document.createEvent("MouseEvent"); //$NON-NLS-0$
	clickEvent.initMouseEvent("click", evt.bubbles, evt.cancelable, window, evt.detail, //$NON-NLS-0$
	evt.screenX, evt.screenY, evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, 
	evt.metaKey, evt.button, anchor);
					anchor.dispatchEvent(clickEvent);
Comment 5 Susan McCourt CLA 2012-06-04 16:37:49 EDT
"Fixed" in
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=c9db0235f31af3150ab3c14f5fa96d86dcd0f239

A gentler fix than described above is to style in some padding to the right of all menu links so that you can more easily "hit" the link as you move your mouse down the menu.  I would have liked to have used a min-width so that the hit area was the same for all menu items, but this did not work given the implementation of menu as a table.  

So I added some padding to the right of all link menu items.  This particularly helps in the user menu, where the links have short names and the menu is wider to accomodate "Keyboard Help".

While experimenting with all this, I noticed that the user menu/related pages coded their own ctrl/key behavior which woudl include having bug 350584, etc.  I converted the menuitems to use CommandMenuItem.  So all of our "links in menus" will behave the same way and any further improvements will work for all...

Marking fixed even though this is not truly fixed, but after talking with Simon and Ken, it seemed better to do the gentle fix than make life worse on IE.