-
Bug
-
Resolution: Fixed
-
P4
-
8u20
-
None
Currently the code in Control handles the accessibility SHOW_MENU action, enabling controls to display their context menus when a user invokes a special accessibility shortcut (e.g. Ctrl+NumPad5 on Mac).
However, FX API allows any Node to add a context menu event handler and process it whenever the event occurs. Thus, any instance of the Node class may display the context menu. To make all nodes accessible, the SHOW_MENU handler should be moved from Control to Node. E.g., the code in Node could look like:
public void accExecuteAction(Action action, Object... parameters) {
if (Action.SHOW_MENU.equals(action)) {
Bounds b = getBoundsInLocal();
Point2D pt = localToScreen(b.getMaxX(), b.getMaxY());
ContextMenuEvent context = new ContextMenuEvent(ContextMenuEvent.CONTEXT_MENU_REQUESTED,
b.getMaxX(), b.getMaxY(), pt.getX(), pt.getY(), false, new PickResult(this, b.getMaxX(), b.getMaxY()));
Event.fireEvent(this, context);
}
}
(perhaps with some adjustments to the way the coordinates and the PickResult are constructed...)
However, FX API allows any Node to add a context menu event handler and process it whenever the event occurs. Thus, any instance of the Node class may display the context menu. To make all nodes accessible, the SHOW_MENU handler should be moved from Control to Node. E.g., the code in Node could look like:
public void accExecuteAction(Action action, Object... parameters) {
if (Action.SHOW_MENU.equals(action)) {
Bounds b = getBoundsInLocal();
Point2D pt = localToScreen(b.getMaxX(), b.getMaxY());
ContextMenuEvent context = new ContextMenuEvent(ContextMenuEvent.CONTEXT_MENU_REQUESTED,
b.getMaxX(), b.getMaxY(), pt.getX(), pt.getY(), false, new PickResult(this, b.getMaxX(), b.getMaxY()));
Event.fireEvent(this, context);
}
}
(perhaps with some adjustments to the way the coordinates and the PickResult are constructed...)
- relates to
-
JDK-8094528 [Accessibility] Mac: context menu hot key not working
- Resolved