Opened 14 years ago

Closed 14 years ago

#5370 closed defect (fixed)

Focus issues for Grid with contextual menus

Reported by: guest Owned by: benschell
Priority: high Milestone: 1.1
Component: DojoX Grid Version: 0.9
Keywords: grid menu Cc: Douglas Hays, haysmark
Blocked By: Blocking:


Given Grid's dojox status, I guess this sort of thing is likely... but when using a context menu as in, the menu focus reliability is patchy at best.

As an example:

  • open the URL above page
  • hit the "Disable Grid Tooltip" button
  • left click in the cell marked "10" in the first row
  • right click in the same location

As I'm doing it right now, the contextual menu will appear briefly and disappear. It's easily reproducible with combinations of focusing and un-focusing other areas and activating the menu.

See Jo-jo in #dojo if more details are required.

Attachments (1)

5370.patch (475 bytes) - added by benschell 14 years ago.
Removes the bad focus behavior.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 14 years ago by guest

As an aside, I believe the issue is Grid handling it's onCellClick, as adding:

grid.onCellClick = function(e) {}

... relieves the focus issue, but deprives one of Grid's sexy row selection action.


comment:2 Changed 14 years ago by guest

yes, i see the same problem. it only happens when a row in the grid is selected. if the row is not selected, the context menu works fine.

comment:3 Changed 14 years ago by Douglas Hays

Cc: Douglas Hays haysmark added
Milestone: 1.1
Priority: normalhigh

This is needed for an IBM product install that will be using Dojo 1.1.

IBM reference # 77536.

comment:4 Changed 14 years ago by benschell

Owner: changed from sorvell to benschell

I'm taking a stab at a whole bunch of Grid bugs. Re-assigning.

comment:5 Changed 14 years ago by benschell

Status: newassigned

comment:6 Changed 14 years ago by benschell

To explain the issue a little further, if a Menu widget is used as a context menu and opened once a row has been selected, mousing over any portion of a selected row closes the menu. This includes:

  • opening the context menu outside of the grid and mousing over the selected row inside the grid,
  • opening the context menu inside the grid on an unselected row, then mousing over a the selected row, and
  • opening the context menu on the selected row.

In the last case (opening on the selected row), the behavior is as described above. That is, the context menu appears briefly then disappears.

The reason is narrowed down to the focus handling inside the grid. Specifically, when a row is moused-over, the row is styled to indicate that (adding the appropriate color bars). Incidentally, the focus manager is also notified of the styling, and in it's handler it re-establishes focus if the row that is styled is the selected row.

This results in the Menu losing focus and closing. I'm not sure why this code is in here, as removing it does not negatively affect any of the focus events. Additionally, I can't see why one would want the focus to return to the selected row when it is moused-over, but I'm open to reasoning.

Patch attached.

Changed 14 years ago by benschell

Attachment: 5370.patch added

Removes the bad focus behavior.

comment:7 Changed 14 years ago by Jared Jurkiewicz

I've talked with Ben on this patch and after him going through explaining what he saw and how he tested the removal, it appears that his fix seems reasonable. As for why the styleRow had code to set the focus that way ... it is unknown at this point. From the tests for grid, removing it doesn't seem to have any adverse affects. So ... Ben's patch will be applied and checked in to trunk.

comment:8 Changed 14 years ago by Jared Jurkiewicz

Resolution: fixed
Status: assignedclosed

(In [12419]) Applying patch for Ben Schell. fixes #5370

Note: See TracTickets for help on using tickets.