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 seems to apply some kind of extra processing on label text before reading it #13102

Closed
raducoravu opened this issue Nov 26, 2021 · 17 comments · Fixed by #13531
Closed

NVDA seems to apply some kind of extra processing on label text before reading it #13102

raducoravu opened this issue Nov 26, 2021 · 17 comments · Fixed by #13531

Comments

@raducoravu
Copy link

Steps to reproduce:

I have a problem is with a combo box which holds a history of regular expressions in a Java application, NVDA does not properly read the text for each entry.
As an example I have a Java application which I'm running with the Java access bridge enabled:

public static void main(String[] args) {
JFrame fr = new JFrame("abc");
fr.setSize(500, 500);
JComboBox combo = new JComboBox(new String[] {"abc", "(<image[^>\\n]*)\\n([^>]*>)"});
combo.setEditable(false);
BasicComboBoxRenderer renderer = (BasicComboBoxRenderer) combo.getRenderer();
renderer.putClientProperty( javax.swing.plaf.basic.BasicHTML.propertyKey, null);
combo.putClientProperty( javax.swing.plaf.basic.BasicHTML.propertyKey, null);

fr.getContentPane().add(combo, BorderLayout.CENTER);
 fr.setVisible(true);
}

When I move the focus in the combo drop down list on the second entry NVDA should read "less than image square bracket....". But somehow it skips the content all the way to the first ">". So NVDA might to apply some kind of regular expression which removes what it considers to be "<tags>" from the content before reading it.

Actual behavior:

NVDA does not read the entire content of the "(<image[^>\\n])\n([^>]>)" value set on the label.

Expected behavior:

NVDA should read the label content as it is, as the label is not HTML aware.

System configuration

NVDA installed/portable/running from source:

Yes

NVDA version:

nvda_2019.3.1

Windows version:

10

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.

No

@lukaszgo1
Copy link
Contributor

Please retry this with the latest version of NVDA 2021.2. If the issue still persists it is possible that NVDA gets a wrong information from the Java app. To rule this out please inspect developer information for the combobox by pressing NVDA+F1 when it is focused.

@raducoravu
Copy link
Author

Thanks @lukaszgo1 , here's what I tried on my side:

  • Downloaded and used NVDA 2021.2, problem persists
  • Downloaded and used JAWS 2021, with JAWS the combo box's list of items is properly read, even for the item which has the text description "(<image[^>\\n])\n([^>]>)".

I also added some logging on the Java side of things and the AccessibleContext specific for the combo box renderer properly returns the value of the item.

So for that particular item with the description "(<image[^>\\n])\n([^>]>)" JAWS reads "less image left bracket....." and NVDA reads "slash n right bracket" so NVDA skips over that entire "<image[^>" part as if it has a regular expression applied over the original content which tries to filter out <tagName>

@CyrilleB79
Copy link
Collaborator

Hello
I do not know so much about this issue.
However just reading this issue, I can see that some part of the template are missing or not filled correctly (did you test without add-ons? did you test on other NVDA versions? is NVDA installed/portable/run from source?)
Could you complete the issue template and also test with a newer version of NVDA (2021.2 or 2021.3beta2)?

@raducoravu
Copy link
Author

@CyrilleB79 thanks for the interested, as I said in the reply above:

 Downloaded and used NVDA 2021.2, problem persists

So I tested with both NVDA 2019.3.1 and 2021.2 and I have the same problem. JAWS 2021 does not have this problem.
I have no idea what running NVDA without add-ons means, I just download NVDA from your web site and run it, in the dialog which shows I choose "Continue running" and use it like that.

@lukaszgo1
Copy link
Contributor

The regular expression which strips simple tags from JAB objects has been introduced in 07d46de, and then expanded to handle comboboxes in 76c3482. For the latter commit there is an issue #3755 which explains that JAB comboboxes can contain unneeded HTML tags which should be removed, but does not provide any examples. @michaelDCurran I understand this code was written ages ago,, but if you would be able to recall specific examples of applications where tags indeed need to be removed that would be most helpful. Also cc @jcsteh since the initial code was written by you.

@raducoravu
Copy link
Author

@lukaszgo1 thanks for the investigation, for extra clarity about our use case adding a screenshot with the part of the application where the combo box item is encountered: Screen Shot 2021-11-29 at 12 59 00

So as the text to find can contain regular expressions, the recent used items may contain "<" and ">" and they need to be read by NVDA.

@seanbudd
Copy link
Member

Image description for the screenshot: The screenshot is of a find & replace dialog. The focus is on a dropdown ComboBox, displaying the search history, where the focused item is (<image[^>\\n]*)\\n([^>]*>).

@jcsteh
Copy link
Contributor

jcsteh commented Nov 30, 2021 via email

@raducoravu
Copy link
Author

@seanbudd thanks for providing the alternate description and sorry for not providing it myself.
@jcsteh yes some Java controls contain HTML content in labels, this one in particular has HTML content disabled, but even if the controls contain HTML content inside it would usually start and end with the <html> tag.

@Brian1Gaff
Copy link

Brian1Gaff commented Nov 30, 2021 via email

@raducoravu
Copy link
Author

@Brian1Gaff I have the same problem with the latest NVDA snapshot I tested (Thu Dec 2 03:05:33 2021)

@mwhapples
Copy link
Collaborator

Looking at the Oracle Java docs, it seems like for labels, buttons, check boxes and various other Java swing controls the way to define that the content contains HTML is to include a <html> tag at the start of the text.
https://docs.oracle.com/javase/tutorial/uiswing/components/html.html
I looked through the JLabel documentation and there is no API functions for discovering whether the label contains HTML, so it seems like the html tag is the way to detect it.
So I would suggest rather than just looking for any tag which may be html, NVDA should look if the text starts with the html tag and only then strip out tags and process escape sequences for < and > and other HTML character escape sequences.

@raducoravu
Copy link
Author

@mwhapples I agree with the proposed change. This would work in most cases.

@mwhapples
Copy link
Collaborator

@raducoravu I have made an initial fix and merge request for this issue, could you test it as well and let me know if that fixes this for you.

@raducoravu
Copy link
Author

@mwhapples thanks for investing your time in fixing this, I tested the NVDA build produced for your pull requests, so if in a Java combo box drop down I have this entry:

   (<image[^>\\n])\n([^>]>)

NVDA now reads "less image greater n n greater greater".
Before the fix NVDA read "n n greater greater".
So it's better, somehow NVDA still does not read the characters "(,[,,^,]" though.

@mwhapples
Copy link
Collaborator

@raducoravu I think the punctuation you mention as not being spoken is due to the punctuation setting. When I have punctuation set to some I get the same result as you, however if I increase it to all punctuation then all characters are correctly spoken. Also regardless of the punctuation setting I do get all characters showing on my Braille display. So I think this is working as would be expected.

@raducoravu
Copy link
Author

@mwhapples thanks, right, I do not have much experience with NVDA settings I'm afraid. So I think this issue can be considered as done.

michaelDCurran pushed a commit that referenced this issue Mar 27, 2022
)

Fixes #13102

Summary of the issue:
NVDA was incorrectly stripping text from Java widgets if the text looked like an XML tag. According to the Oracle Java docs, when using HTML in a Java widget you should start the text with the <html> tag.

Description of how this pull request fixes the issue:
This change gets NVDA to check if the text starts with <html> and only then will remove any text which appears to be XML tags.
@nvaccessAuto nvaccessAuto added this to the 2022.2 milestone Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants