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 Previous Line Instead of speeking "Blank" for Empty Lines in PyQt6 applications for QTextEdit and QPlainTextEdit widgets #17419

Open
snufas opened this issue Nov 19, 2024 · 8 comments
Milestone

Comments

@snufas
Copy link

snufas commented Nov 19, 2024

I am trying to use pyQT6 and I'm testing out variety of widgets available and how accessible they are.
there is a problem how NVDA is reading. multi line text from
QTextEdit and QPlainTextEdit widgets in PyQt6 applications.

Steps to reproduce:

You can download the demo application source code that I made for demo purposes to properly investigate The problem.
text_viewer.txt
is a Python file just rename it. But I will illustrate the example anyways.

The problem is basically this, rather than reading "blank" for the emty line, it reads a previous line instead.
for example:
This is line 1

And this this line 2

it would be read like so
This is line 1
This is line 1
And this this line 2

Expected behavior:

it should be read like so:
This is line 1
" blank" spoken tekst for the new line
And this this line 2

Related Logs

Developer info for navigator object:
name: 'Text Viewer'
role: EDITABLETEXT
processID: 7200
roleText: None
states: FOCUSABLE, FOCUSED, READONLY
isFocusable: True
hasFocus: True
Python object: <NVDAObjects.Dynamic_EditableTextWithAutoSelectDetectionUIA object at 0x098A83F0>
Python class mro: (<class 'NVDAObjects.Dynamic_EditableTextWithAutoSelectDetectionUIA'>, <class 'NVDAObjects.behaviors.EditableTextWithAutoSelectDetection'>, <class 'NVDAObjects.behaviors.EditableText'>, <class 'NVDAObjects.behaviors.EditableTextWithSuggestions'>, <class 'NVDAObjects.behaviors.InputFieldWithSuggestions'>, <class 'NVDAObjects.behaviors.EditableTextBase'>, <class 'editableText.EditableText'>, <class 'NVDAObjects.UIA.UIA'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'documentBase.TextContainerObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <class 'garbageHandler.TrackedObject'>, <class 'object'>)
description: ''
location: RectLTWH(left=109, top=157, width=582, height=334)
value: 'this is line 1\n\nand this this line 2'
TextInfo: <class 'NVDAObjects.UIA.UIATextInfo'>
appModule: AppModule(appModuleHandler, appName='python', processID=7200)
appModule.productName: 'Python'
appModule.productVersion: '3.9.13'
appModule.helperLocalBindingHandle: c_long(122649672)
appModule.appArchitecture: 'AMD64'
windowHandle: 594166
windowClassName: 'Qt670QWindowIcon'
windowControlID: 0
windowStyle: -1764818944
extendedWindowStyle: 256
windowThreadID: 23008
windowText: 'Accessible Text Viewer'
displayText: ''
UIAElement: <POINTER(IUIAutomationElement) ptr=0x4b5aec8 at 968ac60>
UIA automationID: 
UIA frameworkID: Qt
UIA runtimeID: (42, 594166, 4, -2147483645)
UIA providerDescription: [pid:7200,providerId:0x0 Main(parent link):Unidentified Provider (unmanaged:qwindows.dll)]
UIA className: QPlainTextEdit
UIA patterns available: TextPattern, LegacyIAccessiblePattern, ValuePattern, InvokePattern

System configuration

NVDA version:

2024.4 (NVDA is installed.)

Windows version:

10.0.19045 N/A Build 19045

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

python 3.9
PyQt66.7.1 (the latest version as of this issue date.)

Other information about your system:

Microsoft Windows 10 Pro

Other questions

Does the issue still occur after restarting your computer?

Yesd

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

No

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

Yes

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

Yes

My thoughts and comments

I'm not entirely sure if the problem lies with NVDA or the library itself. Other UI elements, like toolbars, buttons, and edit boxes, work fine.

Jaws has exactly the same behavior. That suggests it might be a problem with the library.

Nonetheless, NVDA needs to function properly with this widely used and important library.

As a side note, the Python WX library isn't great. I believe this issue needs attention because UI libraries are crucial for accessibility. This shouldn't be overlooked, as Python QT is a major library that requires full support.

I don't have the expertise to investigate this properly, but I'm hoping the developers do. Please include this issue in the milestones so I know it's a work in progress.

Thanks for grate work!!!

@Adriani90
Copy link
Collaborator

Related to #9376. There was PR #16568 trying to fix that one, but it was reverted in #17084 due to introduced regression.

@snufas
Copy link
Author

snufas commented Nov 19, 2024

@Adriani90

@snufas snufas closed this as completed Nov 19, 2024
@github-actions github-actions bot added this to the 2025.1 milestone Nov 19, 2024
@snufas snufas reopened this Nov 19, 2024
@snufas
Copy link
Author

snufas commented Nov 19, 2024

I managed to close the issue by accident... re opened all good.
@Adriani90 I checked the issue, it seems to be related with the Java, not Python, but regardless that needs to be looked at.

@CyrilleB79 CyrilleB79 removed this from the 2025.1 milestone Nov 19, 2024
@Emil-18
Copy link
Contributor

Emil-18 commented Nov 19, 2024

@snufas I think that is an issue with QT, and not NVDA. All other screen readers I have tested has that same problem. What is wrong with wx? To my knolage, wx is the most accessible python GUI library out there

@dmitrii-drobotov
Copy link
Contributor

Right, just to confirm, #9376 affects only apps using Java Access Bridge as the accessibility protocol, but from logs in the description I assume Qt uses UI Automation. So, while this is a separate issue, the cause may be very similar and related to the way Qt reports line bounds or how the _getLineOffsets method is implemented for UI Automation objects.

@snufas
Copy link
Author

snufas commented Nov 20, 2024

@Emil-18

@snufas snufas closed this as completed Nov 20, 2024
@github-actions github-actions bot added this to the 2025.1 milestone Nov 20, 2024
@snufas
Copy link
Author

snufas commented Nov 20, 2024

@Emil-18 It probably is QT issue, However, that needs to be confirmed by developers themselves. I can't report it because I don't know what exactly is the problem.
regarding wx
PyQt supports Microsoft's UIAutomation where as python wx does not. python wx Accessibility is based on old MSAA.

acording to chatgpt:
Microsoft Active Accessibility (MSAA) is an older technology developed by Microsoft to help software applications provide information about their user interface to assistive technologies, such as screen readers. It allows these technologies to interact with and retrieve information about UI elements, enabling users with disabilities to use applications more effectively.

Better API Framework:

  • UI Automation (UIA): This is the successor to MSAA and is generally considered a more modern and robust framework. UIA provides more detailed information and greater control over UI elements, making it more suitable for today's complex applications. It supports a wider range of UI elements and is designed to work across different Windows platforms.

In summary, while MSAA laid the groundwork for accessibility on Windows, UI Automation is the better choice for new applications due to its enhanced capabilities and support for modern UI elements.

@snufas snufas reopened this Nov 20, 2024
@snufas
Copy link
Author

snufas commented Nov 20, 2024

Alright, there is weird issue going on with me opening and closing the issue. There is some shortcut probably that I don't know. So, I'm gonna be very careful from now on. in providing the comments...
Generally speaking, I will repeat myself again that I think it's the NVDA who needs to report this because they can investigate exactly what the problem is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants