vaadin / context-menu

Vaadin ContextMenu
Apache License 2.0
11 stars 21 forks source link

Receive focus on context click ? #23

Open phansson opened 8 years ago

phansson commented 8 years ago

Why is that a context-click (aka right-click) doesn't fire a focus event? I'm just asking because I'm not fully aware how the same situation is in other frameworks, such a Swing.

To me there should be a least be an option for a context-click to also trigger a focus event. Not sure if such functionality belongs in the add-on or in the framework.

The consequence of not having the focus change on context-click is that the user gets very confused. "Which row did I actually click?" (surely not the one with the focus border).

On Grid I've currently semi-solved the problem by turning off completely the visual indicator for focus on cells. This I've done via CSS. For reference this works for me:

  // Turn off focus visual indication for grid cells
  .v-grid:focus .v-grid-cell-focused:before {
      display: none;
  }

However this will not solve the problem for those who still (for one reason or another) require the visual indicator for focus.

To solve this usability issue I still believe the best option is to have a context-click trigger a focus event as well.

samie commented 8 years ago

Yes. We briefly investigated this and came to same conclusion: focus should follow click (or mouse down). Marking this one as bug here, but it most likely needs a framework-level fix in the context click event.

juergenkoras commented 8 years ago

I generally agree on this. But it still must be possible to have a context menu for multiple selections... We solved this by adding "grid.select(...)" calls in a ContextMenuOpenListener. As normally you have different menu entries for multiple selection than for single selection, we needed the listener anyway.

samie commented 8 years ago

You're right. There is difference between "selection" and "focus". We found that typically in desktop environment focus follows mouse down, but that does not (at least not always) affect the selection yet. Text selections seems to be exception to this rule.