Understanding textInfo field madness

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Understanding textInfo field madness

derek riemer

I'm bantering around with implementing #4904 and wanted to run some things by people.

* it seems like if I ask for the fields and text of a line, I'm given a list of fields, including all of the controls from most ancestorish, to least ancestorish. (descending into the object hierarchy as you go along the list). For example:
s is controlTypes (I'm lazy in the python console), e is the list of fields for a line of text in a web browser on a specific edit field.
>>> [s.roleLabels[i.field["role"]] for i in e if not isinstance(i, basestring) and i.command=="controlStart"]
[u'document', u'section', u'section', u'section', u'section', u'form', u'edit']
* There's also a way to get the presentation category of an field (Or there's a method to do this at least). Is there by chance a way to get if a field is an interactive category? Is there a way to ask a field if it's something we can interact with, and is there a chance that I can ask a field that may be interactive if it has multiple lines? (Imagine a multiline link with
<a href="#">Hello<br/><br/>Friends</a>
If I ask for line two, I'm gonna get a controlStart, controlStart until I hit the link, then blank, and control end n times until I've jumped up to the document level I think. I'd like to be able to ask a control Hey, are you an interactive container, and is the text I'm looking at in you important (The only blank line in this text)?
if we have a link <a blahblahblah><span aria-hidden="true"><img alt="" src="fancy-icon.svg"/></span></a> or something, we might get no text in the link, and we can't skip this as a blank line. The user must see it since they need to interact with it potentially. Another example is <div onclic="doSomething()"><img src="fancy-clickme-icon.svg" alt=" "></div>
* My investigations so far gave me the below design. What do you think? Is this scalable, and/or should it change?

We first add a method to CursorManager called _shouldSkipBlankLines
This method takes a text info, and returns yes or no. It first needs to hit config and return no if the user doesn't want blank lines skipped.
Then, it does whatever needs done based on the implementation. Currently, I return False on the base CursorManager, because it's feasible that cursor managers are used for non-browseMode things.
browseMode.BrowseModeDocumentTreeInterceptor has the method defined on it overriding the default. It needs to skip lines if user wants to, and if the blank line is not significant for interactive content. Each browseMode implementation should override if need be, to do whatever.

Now, in _caretMovementScriptHelper

Try to move.
If we moved, and we landed on a blank line, if we should skip blank lines, and we actually moved somewhere, set direction to either 1 unit or -1 unit depending. Try to move until we can't move again, or until we don't hit a blank line.


Derek Riemer

  • Department of computer science, third year undergraduate student.
  • Proud user of the NVDA screen reader.
  • Open source enthusiast.
  • Member of Bridge Cu
  • Avid skiier.

Honors portfolio
Awesome little hand built weather app!

[hidden email]
Phone: (303) 906-2194

Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Nvda-devel mailing list
[hidden email]