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
Add support for UIA with chromium based browsers #12025
Conversation
I'm slightly worried about introducing underscores in the names here, as it is not following the naming conventions we usually use. |
True we have not used underscores before, however, I think this is a
suitable way to very clearly denote very different implementations of
Edge. Especially when they are living in the same directory.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm perhaps there should be more structure here eg "namespaces". Consider if we moved the files:
|
I'm okay with either way. Don't think the further directory structure is
necessary work, but fine if it gets done.
|
source/NVDAObjects/__init__.py
Outdated
@@ -417,6 +417,9 @@ def _get_name(self): | |||
""" | |||
return "" | |||
|
|||
#: Type definition for auto prop '_get_role' | |||
role: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this annotation is correct since roles are represented by ROLE_
constants in controlTypes
and they are integers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right @lukaszgo1, good catch.
I've been looking at the layout of this code and reconsidering whether a nested structure is better. I think it is better for this code to stick with a flatter structure, otherwise there are dependencies going in the wrong direction:
I will however rename spartan_edge and anaheim _edge to spartanEdge and anaheimEdge respectively. |
89d2d34
to
d667d35
Compare
UIA.Web is a new base for browser specific implementations: - spartan-edge - Chromium based browsers: anaheim-edge, chrome This commit is a direct move (no alterations) of code to preserve history. - Move function splitUIAElementAttribs - Move EdgeTextInfo - Move shareable aspects of class EdgeNode: * _get_role * _get_states * _get_ariaProperties * _get_isCurrent * _get_roleText * _get_placeholder * _get_landmark - Move class EdgeList - Move class EdgeHeadingQuickNavItem - Move class EdgeHeadingQuicknavIterator - Move shareable aspects of class EdgeHTMLTreeInterceptor: * makeTextInfo * shouldPassThrough * _iterNodesByType
This is a module containing common classes above the browser specific classes (edge.py, chromium.py). The browser specific classes inherit from these web module classes. - Move splitUIAElementAttribs(attribsString) from edge module to web module - Move common implementation of edge.EdgeNode and rename to web.UIAWeb(UIA), edge.EdgeNode now inherits from web.UIAWeb. - Move implementation of edge.EdgeList and rename to web.List(UIAWeb), edge.EdgeList now inherits from web.List - Move implementation of edge.EdgeHTMLTreeInterceptor and rename to web.UIAWebTreeInterceptor, edge.EdgeHTMLTreeInterceptor now inherits from web.UIAWebTreeInterceptor
The concrete implementation relied on knowing that self is actually a subclass and providing varied behaviour. Instead, abstract this test so it can be altered via polymorphism.
Use chromium treeinterceptor Use Web module for chromium module Use chromium.ChromiumUIADocument in findOverlayClasses
Trade off: slight degradation of performance. UIATextInfo._getTextWithFieldsForUIARange: Test each child to see if it is clipped by or lives completely outside the parent text range, and if so appropriately clip the child range and break out of the for loop. Previously these checks only happened on the final child to try and avoid extra calls, but Edge sometimes returns many more children then it should when on the end of a list, and a trivial slow down is much preferred over a 20 second freeze.
Trade-off: only the first line is fetched. speech.getObjectSpeech: If the given object should have its text presented (E.g. a document or edit field) and the line at the selection cannot be fetched, then only present the first line. Previously the text for the entire object would be fetched, which in the case of Edgium, was extremely costly and could cause a freeze of 10 seconds or more.
As headings are exposed in the element tree, don't expose them in format fields.
UIATextInfo._getTextwithFieldsForUIARange: skip children that appear completely before the start of the parent textRange. Stops a freeze on some checkboxes in Edgium and is generally safer.
Make sure interactive / presentational lists are presented correctly in browseMode in Edgium.
… with UIA Embedded object characters in Edgium should not stop overriding labels from being used.
Allows ignoring of layout tables when configured to do so.
Ensure the value of comboboxes are used as content.
Names of controls (that do not use their name as content) are always reported: Currently no way to tell if author has explicitly set name. Therefore always report the name if the control is not of a type that by definition uses its name for content. This may cause some duplicate speaking, but that is currently better than nothing at all.
d667d35
to
49c04df
Compare
PR #12025 was not squash merged (which is the usual practice for this project). Instead, to preserve the history of moved then modified code, the commits have been rebased directly onto master.
…12319) Fixes #12114 PR #12025 started catching only very specific exceptions when getting selection of edit fields. However in Firefox attempting to get caret for non focused edit fields results in RuntimeError which made it impossible to speak these controls. Description of how this pull request fixes the issue: When getting content of edit fields in speech, we're now catching RuntimeError as well and treating this situation like no selection.
This is based off of PR "Add advanced setting to allow UIA in chromium based browsers #11079"
However, due to the large amount of moved code, NV Access has decided not to squash this PR. Instead the commits have been cleaned up to make following the history as easy as possible. The changes from #11079 are as follows:
This PR supersedes and thus closes #11079, however the history there is still relevant and useful.
Link to issue number:
Related to #10555
Summary of the issue:
Chromium based browsers now contain a UIA implementation which may be exposed (E.G. in Edge Anaheim). Allowing this to be used will allow developers to work to stabilize and mature this technology. For users on systems where process injection is not possible, access to UIA in Edge can act as a fallback option.
Description of how this pull request fixes the issue:
Provides an advanced setting to use UIA when available. Moves significant portions of the UIA code for reuse:
Testing performed:
Manual testing.
Known issues with pull request:
None
Change log entry:
New features