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 repeats the penultimate line of a text in a java application when the last line is empty #9376

Open
fernando-jose-silva opened this issue Mar 14, 2019 · 7 comments · Fixed by #16568
Labels
component/java-access-bridge p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority

Comments

@fernando-jose-silva
Copy link

Steps to reproduce:

In the organization where I work I use software written in java, this software is internal development, and unfortunately I can not grant external access, and I'm still a layman in programming.
However I believe this may occur in other java applications.
Open a java application where there is an edit field to type text.
Write a line of text and just below leave an empty line.
When reading the last line that is empty:

Actual behavior:

The nvda repeats the contents of the penultimate line.

Expected behavior:

The nvda should read empty line when reading the last line.
The nvda should read when reading the first line the typed text.
In the next line that is the last of the text that is empty the nvda should read empty line.

System configuration

NVDA installed/portable/running from source:

intaled

NVDA version:

2018.4.1

Windows version:

10 1803

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

aplication java execute jre 8 update 201

Other information about your system:

Other questions

Does the issue still occur after restarting your PC?

yes

Have you tried any other versions of NVDA?

no
log:
line_java.txt

@mohammad-suliman
Copy link
Contributor

mohammad-suliman commented Mar 17, 2019 via email

@cary-rowen
Copy link
Contributor

Yes, this can still be reproduced in Android Studio.

cc @mwhapples I remember you once fixed a batch of bugs in a Java application, what do you think about this?

thank you for your efforts

@OzancanKaratas OzancanKaratas added p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority component/java-access-bridge labels Mar 1, 2024
@mwhapples
Copy link
Collaborator

This is also an issue in IntelliJ, PyCharm, etc, point being these are newer than AndroidStudio's editor and there are no fixes coming down the pipe from those. I cannot remember if I looked at this specifically, I would want to check whether its a wider Java Accessibility issue or specific to the JetBrains IDEs.

@dmitrii-drobotov
Copy link
Contributor

I can confirm it reproduces with a regular JTextArea in a basic Swing app, for example:

package JTextAreaTest;

import javax.swing.JFrame;
import javax.swing.JTextArea;

public class JTextAreaTest {
    public static void main(String[] args) {
        JTextArea textArea = new JTextArea();
        textArea.setText("1\n2\n3\n");
        textArea.setEditable(true);

        JFrame frame = new JFrame("JTextArea test");
        frame.getContentPane().add(textArea);
        frame.setSize(200, 200);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

seanbudd pushed a commit that referenced this issue May 20, 2024
…ridge (#16568)

Fixes #9376.

Summary of the issue:
In applications using Java Access Bridge, if the last line of a text is an empty line, then NVDA reads the previous line as the last line.

Description of user facing changes
NVDA will now correctly read the last empty line as "blank".

Description of development approach
The issue is related to fixes of #1892 in 7ef99c3, which work around the line bounds returned by JAB for the last character of a text. Specifically, the current behavior is to get the line bounds of the previous character, which works well for single-line text inputs. But if the text is multi-line, and we're on the last empty line, then getting the line bounds of the previous character results in repeating the penultimate line.

The fix is to separately handle the case of empty last line, which is determined by having "\n" as the previous character.
seanbudd pushed a commit that referenced this issue May 20, 2024
…ridge (#16568)

Fixes #9376.

Summary of the issue:
In applications using Java Access Bridge, if the last line of a text is an empty line, then NVDA reads the previous line as the last line.

Description of user facing changes
NVDA will now correctly read the last empty line as "blank".

Description of development approach
The issue is related to fixes of #1892 in 7ef99c3, which work around the line bounds returned by JAB for the last character of a text. Specifically, the current behavior is to get the line bounds of the previous character, which works well for single-line text inputs. But if the text is multi-line, and we're on the last empty line, then getting the line bounds of the previous character results in repeating the penultimate line.

The fix is to separately handle the case of empty last line, which is determined by having "\n" as the previous character.
@RafaelFernandesBR
Copy link

Hello, there is a program that has the same problem here.
It's Sonic.
https://sonic-pi.net/

Could this be something in the program code itself, or could it be NVDA?

@dmitrii-drobotov
Copy link
Contributor

@RafaelFernandesBR Hi, from what I can tell, Sonic uses Qt for the user interface, and this NVDA issue only affects Java applications, so it must be a different problem. I would suggest to report this bug to the Sonic repo: https://github.com/sonic-pi-net/sonic-pi.

@snufas
Copy link

snufas commented Nov 19, 2024

@Adriani90 I don't see how this issue fits here hence it's a Python not Java?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/java-access-bridge p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants