Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NVDA does not announce the multi-line state and the complete multi-line text of a JTextArea (JAB) #14609

Closed
anOolamr opened this issue Feb 3, 2023 · 4 comments · Fixed by #15557
Labels
component/java-access-bridge p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@anOolamr
Copy link

anOolamr commented Feb 3, 2023

If a JTextArea with a longer, multi-line gets the keyboard focus, NVDA does not read the complete text, but only the first line of the text. This is confusing, in particular if the first sentence has more than one line or if the text is not editable and the information needs to be announced as a whole. As NVDA does not announce the multi-line state of the JTextArea, the user does not get the information that the text can have more than one line. I would expect that NVDA announces the multi-line state and starts reading the complete text of a JTextArea (according to the NVDA announcement of an e-mail message). The user can easily stop the text reading by pressing Ctrl key.

I wrote a simple application Test_JTextArea_with_multilineText.jar and attached it to this bug report. (If you prefer a .java file, you can find it within the .jar file.)
Test_JTextArea_with_multilineText.zip

Steps to reproduce:

Extract the Test_JTextArea_with_multilineText.jar file from the linked .zip file and execute the attached .jar file with an up-to-date JRE version.

The application opens a frame containing a labeled JTextField and a labeled JTextArea. The text field has a single-line text whereas the text area has a longer, multi-line text. Both, the text field and the text area are not editable.

After starting the application, the following (see Actual behavior) is announced by NVDA.

Actual behavior:

Single-line and multi-line text
filler
filler
Single-line text: edit read only This is a text
tab
filler
Multi-line text: edit read only This is the first part of a
down arrow
longer text. This is the
down arrow
second part of a longer
down arrow
text. This is the third part
down arrow
of a longer text. This is the
down arrow
fourth part of a longer text.
down arrow
fourth part of a longer text.
down arrow
This is the last part of a
down arrow
This is the last part of a
down arrow
This is the last part of a
down arrow
This is the last part of a

(NVDA has an additional issue reading the last sentence completely.)

Expected behavior:

tab
Multi-line text: edit read only multi-line This is the first part of a longer text. This is the
second part of a longer text. This is the third part of a longer text. This is the fourth part of a longer text. This is the last part of a longer text.

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

installed

NVDA version:

[Window Title]
About NVDA

[Content]
Version: 2022.4 (2022.4.0.27401)

Windows version:

Microsoft Windows 10 Enterprise
Version 10.0.19044 Build 19044

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

java version "17.0.6" 2023-01-17 LTS
Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)

Other information about your system:

Java Access Bridge is enabled.

Other questions

Does the issue still occur after restarting your computer?

Yes.

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

Same behavior in previous versions of NVDA.

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.

@michaelDCurran
Copy link
Member

NVDA does seem to map the Java accessibility multi_line state to NvDA's multiline state.
So I'm guessing that this particular Swing control does not expose the multi_line state?
@mwhapples do you have any thoughts?

@anOolamr
Copy link
Author

Java's jaccessinspector reports the following states when this JTextArea is focused:
"States in en_US locale: enabled,focusable,visible,showing,focused,opaque,multiple line"

@seanbudd seanbudd added p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority component/java-access-bridge triaged Has been triaged, issue is waiting for implementation. labels Feb 12, 2023
@benjschneider
Copy link

I am running into the same issue. I have a JTextArea showing multiple lines of text and NVDA reads them line by line rather than one continuous block of text.

According to jaccessinspector the component reports the multiple line state as expected (@anOolamr).

Is this a bug in NVDA? I am happy to send a PR if someone points me into the right direction of where to fix this.

@dmitrii-drobotov
Copy link
Contributor

dmitrii-drobotov commented Oct 2, 2023

I've made a PR with a fix for not properly detecting multiline state with JAB: #15557.

NVDA still reads only the first line, but it matches how other multi-line readonly edits are read (e.g. NVDA Speech Viewer). The problem is that Java's AccessibleRole.TEXT is always mapped to NVDA's Role.EDITABLETEXT, while not editable JTextArea is a plain text component and should probably be mapped to Role.STATICTEXT. Unfortunately, Java doesn't have two different roles for editable and plain texts, so from the NVDA's side, it might not be simple to distinguish read-only edit text (like NVDA Speech Viewer with caret and selection) and plain text.

@nvaccessAuto nvaccessAuto added this to the 2024.1 milestone Oct 3, 2023
seanbudd pushed a commit that referenced this issue Oct 3, 2023
Fixes #14609

Summary of the issue:
NVDA doesn't report multi-line state for Java Access Bridge components that expose it.

Description of user facing changes
NVDA will correctly report multi-line state in applications using Java Access Bridge.

Description of development approach
Added mapping from "multiple line" JAB state to NVDA multiline state. There is already a mapping from "multi_line" JAB state to NVDA state, but the string was incorrect, so NVDA didn't announce it. JAB uses the string from the following resource file: https://github.com/openjdk/jdk/blob/516cfb135f7e5fefaf6e6f2928f6ecb88806f1ef/src/java.desktop/share/classes/com/sun/accessibility/internal/resources/accessibility_en.properties#L114. Existing "multi_line" value probably comes from the name of Java's AccessibleState.MULTI_LINE const, but it doesn't seem to have ever been used as a resource value after looking at the git history. I still kept it in the mapping to ensure backwards compatibility: while unlikely, it's possible that in older Java versions the value was "multi_line".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/java-access-bridge p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants