<Swing Dev> [13] Review Request: 8226653 [accessibility] Can edit text cell correctly, but Accessibility Tool reads nothing about editor

Phil Race philip.race at oracle.com
Thu Jul 11 18:31:27 UTC 2019


It seems we don't have a method like boolean 
Toolkit.isModifierKeyCode(int keyCode) ? I mean if we did, then it could 
internally know what are the modifier keys for the current platform and 
you wouldn't have that set of ORs. Why was the return value being 
ignored here ? I presume this method must have a side-effect that is 
part of what you are describing ? 7113 Component component = 
renderer.getTableCellRendererComponent(
7114 JTable.this, null, false, false,
7115 row, column); -phil



On 7/10/19 10:16 PM, Sergey Bylokhov wrote:
> Hello.
> Please review the fix for JDK 13.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8226653
> Fix: http://cr.openjdk.java.net/~serb/8226653/webrev.01
>
> Short description:
>
>   If the user starts to edit the cell in the "default" JTable then we
> show the text editor in the cell but did not transfer the focus to it.
> This feature breaks the accessibility tools, which cannot report
> information about the current editor.
> I suggest to try it in the SwingSet2 to see how this feature actually
> works. The idea of the current fix is to disable this feature + some
> other related small fixes.
>
>
> Long description(from small changes to big):
>
>  - CAccessible.java:
>     When the user completes the editing of the cell we post
>     ACCESSIBLE_TABLE_MODEL_CHANGED event, and we need to notify the
>     native system that the data inside the table was changed.
>
>  - JTable.processKeyBinding():
>     1) We do not want to start editing of the cell if the only modifier
>        key is pressed, but some of the modifier keys were missed:
>        VK_ALT_GRAPH and KeyEvent.VK_META(which is CMD key on the macOS).
>     2) To enable the "surrendersFocusOnKeystroke" property, I have to add
>        one more flag, because I cannot do this via the public API:
> https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/JTable.html#setSurrendersFocusOnKeystroke(boolean)
>        Note that it is specified as "false" by default, and setting it
>        to "true" even under the Accessibility tool may break the spec.
>        Probably we need to clarify this behavior in JDK 14.
>
>  - JTable.java.getAccessibleAt()/getAccessibleChild():
>     The accessibility API represent the table as a grid of cells, and 
> ignores
>     the real child of the table. Each cell is represented as a
>     AccessibleJTableCell, this AccessibleJTableCell is used as a proxy 
> object
>     and transfer all requests to the real component which is 
> responsible to
>     draw the cell. Note that it is specified that the render is 
> returned by
>     some of its methods:
> https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/javax/swing/JTable.AccessibleJTable.AccessibleJTableCell.html#getCurrentAccessibleContext()
>     So we cannot modify these methods to return context of the editor, 
> instead
>     I added the switch before we return "AccessibleJTableCell".
>     In JDK 14 it can be moved to the "right" place.
>
>
> Addition thoughts about "FocusOnKeystroke" feature:
>  - We can leave this feature as-is and report the current editor to
>    the accessibility tool even if the editor is not focused, but this may
>    confuse the user because it will not be possible to move the cursor or
>    select the text from the keyboard and this is not expected behavior 
> of the
>    text editor.
>  - We also can disable the editing of the cell on the fly, and start 
> it only
>    if the user emulates the mouse click inside the table.
>  - Or we can leave everything as-is and move the responsibility for this
>    feature to the application, which will enable or disable 
> "FocusOnKeystroke" feature.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20190711/7e47cc42/attachment-0001.html>


More information about the swing-dev mailing list