[jawsscripts] Re: Best way of locating focus on elements in Web-based apps?

  • From: Scott Huey <shuey@xxxxxxxxx>
  • To: "jawsscripts@xxxxxxxxxxxxx" <jawsscripts@xxxxxxxxxxxxx>
  • Date: Thu, 27 Mar 2014 17:10:58 +0000

To date I have never managed to find a way to force the VPC surgically based on 
a DOM object, since JAWS is reaping that buffer from the IAcc2 interface and 
then putting it in a closed black box. What I can tell you is that if you're 
working with GreaseMonkey to inject ARIA markup (I honestly thought I might be 
the only person in the world trying to do that), there is a nifty trick you can 
use with that code. HTML4 doesn't really care about any tags which it doesn't 
recognize, and HTML5 supports what they call "data tags" which the HTML parsing 
engine will ignore as long as the tag name begins with "data-" (the word "data" 
and a single dash, for anyone with punctuation verbosity turned down). So if 
you shove a custom tag that starts with the right phrase into the page source 
(say, "data-ControlPanelItem"), the rendered content in the browser won't react 
at all, BUT that tag ends up being streamed out to JAWS as an element attribute 
through IAcc.  The trick I found for leveraging this is that by injecting a 
specific markup, you can pre-tag HTML elements you might like to use as fence 
posts in the code with a custom data tag (again say, "data-ControlPanelItem"), 
then use GetListOfTagsWithAttribute to either evaluate or display them to the 
user. From there, MoveToTagWithAttribute can force the VirtualPC cursor to move 
to their location in the virtual buffer. 

I have yet to determine a way to have a web page trigger this sort of action 
autonomously (since the Javascript/JQuery I can put in GreaseMonkey is too 
heavily sandboxed to allow a raw COM call out), but I think conceptually it 
WOULD be possible if one could set up a custom XPCOM FireFox app or plugin that 
could respond to specific custom DOM events that the javascript could throw and 
forward them to JAWS in the format of a RunFunction API call. A dangerous path 
in terms of security, potentially, but it would be mechanically feasible. It 
might also be possible with some aggressive leveraging of ARIA-selected to 
trick JAWS into responding to a web page focus event and moving the virtualPC 
cursor itself, but I have yet to really bear out any success on that avenue. 

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx 
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Jim Snowbarger
Sent: Thursday, March 27, 2014 11:19 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Best way of locating focus on elements in Web-based 
apps?

This was a timely question for me, since I'm dealing with some of the same 
things.  What I wanted to do was to move the virtual cursor to a particular 
place.
I have a case where the vc is in one place.  And, you activate this treeview 
type of control, and pick an item in the treeview.  When you do that, text 
changes in another part of the page, to reflect the selection.  And, there is 
no convenient way, so far, of flipping over to that other place.
We are adapting this requirements management tool, called Contour.
A wizzy friend of mine got this tool called Grease Monkey, which is a pluggin 
for Firefox.  With that tool, he was able to add Aria tags  to the incoming 
HTML, as long as we use firefox.  Part of that was what I think are called 
relationships.  Basically, it draws a connection between two elements, no 
matter where they sit on the page.  And, there is a new jaws function, 
MoveToControlledTarget.  I don't know if this relationship is biDirectional,  
can't recall.  But, if the virtual cursor is on one end of this relationship, 
and you execute MoveToControlledElement, the VC will move to the companion 
control.  So, that has been helpful.
But, this markup script for Greese Monkey is kind of hard to create if you 
don't already pretty well understand what is going on.  And, quite honestly, I 
can't say I do.

But, in general, what I wanted to do was to somehow navigate the DOM in script 
land, get to some element, and force the virtual cursor to go there.


----- Original Message ----- 
From: "Travis Roth" <travis@xxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Thursday, March 27, 2014 8:10 AM
Subject: [jawsscripts] Re: Best way of locating focus on elements in 
Web-based apps?


I a not sure I understand what you are asking...
However, if you want to determine the active element that the browser is
focused on you can do this via the DOM. This works in IE:
Var
Object o,
Object element
o = IEGetCurrentDocument ()
element = o.activeElement
; you can see the HTML of this element:
html = element.outerHTML

If you want to do the opposite which is to move the browser to a control,
assuming it can receive focus such as an input control and you know the ID
of it you can do this via the DOM also.
o = IEGetCurrentDocument ()
element = o.getElementById(htmlID)
element.setFocus()

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Geoff Chapman
Sent: Thursday, March 27, 2014 2:10 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Best way of locating focus on elements in Web-based
apps?

Thanks to many of you up here, who so kindly told me about the,
"SetJawsFindText", and "JawsFindNext" functions,  I now have been able to
set up some lovely shortCut keys for the user to very quickly locate and
activate buttons in his new Web-based front end customer service system.
And that's so far workin a treat!
:)
However, I'd like to go a level deeper now, and be able to learn how I might
least invasively, but most efficiently/robustly, locate and bring PCCursor
focus to,a given control, (or "element" I think is the term used in Web
land?) rather than just blindly using virtual find to locate text on a page.
Since sometimes, of course, text being looked for, using virtual find
mechanisms, may occur both as  an element label, and as non-clickable plain
text on the page.

And sometimes, as in this case, even as part of other Same type elements!
E.g. suppose I have an edit field, whose label is "search," but there are
several other occurrances of the word "search" on the page.
Not only this, but there is at least one other edit field element labelled
"favorite searches," which would of course get picked up on any
StringContains deal.

What would people suggest might be some code snippets/ideas/methodologies I
might try, to accomplish tooling through elements looking for this
particular edit control, whose label is merely the word "Search," and
nothing else?

Thanks much for any tips anyone would care to share on this one?

Geoff c.

__________�

View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts


__________�

View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts



__________�

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts


__________�

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: