nvda icon indicating copy to clipboard operation
nvda copied to clipboard

NVDA does not explicitly announce the "leaf" information

Open anOolamr opened this issue 1 year ago • 10 comments

NVDA does not explicitly announce the leaf information when the keyboard focus navigates to a leaf item.

See also bug report #13623.

See also #13891

Steps to reproduce:

  1. If not available, download the SwingSet2 Demonstration Program from: https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html#swingset2

  2. Start NVDA.

  3. Launch SwingSet2.jar with an up-to-date Java JRE. -> The SwingSet2 application window appears.

  4. Navigate with arrow right key to the "JTree demo" radio button and press spacebar to select it.

  5. Press Tab key twice to navigate to the JTree control. -> NVDA announces the "Tree" role of the JTree control.

  6. Press arrow down key once to select the root node. -> NVDA announces the name "Music", some state information ("selected, expanded, editable") and the position ("1 of 1, level 1") of the root node.

  7. Press arrow down key once to select the first child item of the root node. -> NVDA announces the level ("level 2"), the name "Classical", some state information ("selected, collapsed, editable") and the position ("1 of 3") of the node.

  8. Press three times alternating arrow right and arrow down. -> NVDA announces the level ("level 5"), the name "No. 1 - C", some state information ("selected, editable") and the position ("1 of 5") of the leaf item. -> Missing announcement: leaf information ("leaf item") Although the collapsed/expanded state information is missing, I would prefer to get an explicit information regarding the leaf property.

Actual behavior:

NVDA does not explicitly announce the leaf property.

level 5 No. 1 - C selected, editable 1 of 5

Expected behavior:

NVDA announces the leaf property explicitly.

level 5 No. 1 - C selected, editable 1 of 5 no child items

or

level 5 No. 1 - C selected, editable 1 of 5 leaf item

System configuration

NVDA installed/portable/running from source:

installed

NVDA version:

Version: 2022.1

Windows version:

Version 10.0.19043 Build 19043

Name and version of other software in use when reproducing the issue:

java version "18.0.1" 2022-04-19 Java(TM) SE Runtime Environment (build 18.0.1+10-24) Java HotSpot(TM) 64-Bit Server VM (build 18.0.1+10-24, mixed mode, sharing)

Other information about your system:

Java Access Bridge is enabled.

Other questions

Does the issue still occur after restarting your computer?

Yws.

Have you tried any other versions of NVDA? If so, please report their behaviors.

Yes. Same behavior.

If NVDA add-ons are disabled, is your problem still occurring?

Not applicable.

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Not applicable.

anOolamr avatar Jul 12 '22 14:07 anOolamr

I don't think I have had these announcements for any treeview with NVDA, so do we want to broaden this to cover treeviews in general rather than just Java's JTree? Also I would question if leaf item is most useful, I would follow how menus are done (I.E. non-leaf nodes would be announced as having subitems or child items, may be even with a count of the child items). I personally feel to state leaf is unnecessarily verbose, where as giving child information is at least providing some information for the additional words.

mwhapples avatar Jul 12 '22 14:07 mwhapples

Considering your comment I think it makes more sense to rely on the announcement of child items than to check the announced state set to find out whether or not an item is a leaf. If child items were announced I would not see a need for announcing "leaf" as leaf property any more. What about announcing "no child items" on a focused leaf item?

anOolamr avatar Jul 13 '22 10:07 anOolamr

@anOolamr Can you expand on why this would help?

Before we can consider this I'd like to be sure we understand the problem you want to solve. What happens when you don't know that there aren't any child items?

feerrenrut avatar Jul 14 '22 06:07 feerrenrut

A tree control consists of three different kind of items: (1) node item containing children (children can be nodes or leaves) (2) node item without children (empty node) (3) leaf item

Current announcement by NVDA regarding these kind of items: (1) additional state announcement (expanded or collapsed) (2) additional state announcement (expanded or collapsed) (3) - (no additional announcement) The additional state announcement is nearly at the end of the node announcement. This consumes time when navigating quickly through a large tree.

Open the "JTree demo" of SwingSet2.jar and test the following:

  • Starting from the root node, expand the tree quickly by pressing the arrow right key several times until the keyboard focus is on the first leaf item.
  • Then collapse the tree quickly by pressing the arrow left key several times until the keyboard focus is on the root node again.

Which type of announcement and which announcement order would help to make these user actions faster? I think announcing the number of child items and the kind of item would help:

  • Expand a node -> announce expanded state of the node, then the name, the number of child items, ... but not the position of the node.
  • Navigate to the child item -> announce the level, the name, kind of item, the position ...
  • Collapse a node -> announce the collapsed state of the node, then the name, the position ... but not the number of child items.
  • Navigate to the parent node -> announce the level, the name, the number of items ... but not the kind of item as this is clearly a node with children

As a further example, I discuss a file explorer displayed as a tree. A file system consists of folders (as nodes) and different kind of files (as leaves). A file folder can have folders and/or files as children, or can be empty. If you navigate within a folder you need to know whether the child item is a folder or a file because the actions on folders are different from the actions on files (e.g. pressing Enter key).

A folder can be empty or can have a number of children. You may need to know how many child items a folder is containing (without first navigating to the first item to get the number from the position announcement). If a folder has for example three child items, you may check each item, but you will not do this if a folder has 1000 child items. Or you may check the number of child items to validate the count of items, for example after an copy-and-paste action. Even if a folder is empty, you want to get the information quickly.

Hope this helps.

anOolamr avatar Jul 14 '22 17:07 anOolamr

Thanks for the extra information @anOolamr, just to reassure you, we are developers who understand tree structures. You've talked about several different situations, let's focus on the menu example specifically. I'd like to understand the precise problem and rationale for wanting different behavior in a specific concrete example, then, once we are sure we have a common understanding we can think about generalizing. Given the title of the issue, perhaps we can start with the menu item "leaf" situation?

Which type of announcement and which announcement order would help to make these user actions faster? I think announcing the number of child items and the kind of item would help:

Your primary concern is improving the efficiency of communicating the structure of a menu, am I interpreting correctly?

Current announcement by NVDA regarding these kind of items: (1) additional state announcement (expanded or collapsed) (2) additional state announcement (expanded or collapsed) (3) - (no additional announcement) The additional state announcement is nearly at the end of the node announcement. This consumes time when navigating quickly through a large tree.

I think you are trying to illustrate the problem, however, we don't necessarily share a common vocabulary for describing the components of speech output it is much clearer if you copy paste in the exact speech from the speech viewer, then paste again and apply modifications to show what you would prefer. The two examples next to each other allows to be certain what you are suggesting for that precise case. I previously edited the description of this issue with my best guess, it would be very helpful if you could confirm or correct it.

feerrenrut avatar Jul 15 '22 11:07 feerrenrut

@feerrenrut Sorry, I didn't realize that you have edited my issue description (didn't even know that this is possible), so I was confused and completely missed the intention of your question. :-(

I would prefer the following announcement:

level 5 No. 1 - C selected, editable 1 of 5 leaf item

"no child items" should be used for empty nodes, but not for leaves to avoid misinterpretation.

anOolamr avatar Jul 15 '22 18:07 anOolamr

I checked the NVDA announcement for JRadioButton(s) and got the following announcement order: name / role / state set / position

As "leaf item" is like a role, I think that the following order would be more equivalent: level 5 No. 1 - C, leaf item, selected, editable, 1 of 5

anOolamr avatar Jul 18 '22 10:07 anOolamr

Again, please provide the exact actual speech and the expected speech you would prefer. Both are required to ensure we are thinking about the same example as you, and we can easily see the difference you would prefer.

feerrenrut avatar Jul 20 '22 00:07 feerrenrut

- Root item
|____
	+ Item 1-1
	- Item 1-2
	|____
		Item 2-1
		- Item 2-2
		Item 2-3
		Item 2-4
	+ Item 1-3

Initial situation: Root node has the keyboard focus, but is not selected.

  • Actual: "tree view"
  • Expected: "tree view, level 1, Root item, expanded, 3 child items, 1 of 1"

Press arrow down key

  • Actual: "Level 2, Item 1-1, selected, collapsed, 1 of 3"
  • Expected: "Level 2, Item 1-1, collapsed, selected, 1 of 3"

Press arrow down key

  • Actual: "Item 1-2, selected, expanded, 2 of 3, level 2"
  • Expected: "Item 1-2, expanded, 4 child items, selected, 2 of 3, level 2"

Press arrow down key

  • Actual: "level 3, Item 2-1, selected, 1 of 4"
  • Expected: "level 3, Item 2-1, leaf item, selected, 1 of 4"

Press arrow down key

  • Actual: "Item 2-2, selected, expanded, 2 of 4, level 3"
  • Expected: "Item 2-2, expanded, 0 child items, selected, 2 of 4, level 3"

anOolamr avatar Jul 20 '22 10:07 anOolamr

Given the title of the issue, perhaps we can start with the menu item "leaf" situation?

@feerrenrut I would not use "leaf" for the announcement of menu items. The announcement for menu structures should be different from the announcement of tree structures. I initially created this bug report related to tree structures.

Example of a File menu structure where F of File is underlined:

File
  Menu item 1    F3
  Menu item 2
    Submenu Item 1
    Submenu item 2
  Menu Item 3    

Press Alt+F to open File menu

  • Actual: "File, menu, selected, checked, Alt+F"
  • Expected: "File, menu, 3 child items, Alt+F"

Press arrow down key

  • Actual: "Menu item 1, selected, F3"
  • Expected: "Menu item 1, F3, 1 of 3"
  • Or extended: "Menu item 1, F3, menu item, 1 of 3"

Press arrow down key

  • Actual: "Menu item 2, menu, selected, checked"
  • Expected: "Menu item 1, sub menu, 2 of 3"

Press arrow right key

  • Actual: "Submenu item 1, selected"
  • Expected: "Submenu item 1, 1 of 2"
  • Or extended: "Submenu item 1, menu item, 1 of 2"

For the menu items I would even prefer a concise announcement and leave out "menu item", except for checkbox menu items ("checkbox, checked" / "checkbox, not checked") and radiobutton menu items ("radio button ...").

anOolamr avatar Jul 21 '22 17:07 anOolamr