[jawsscripts] Re: Element attribute values.

  • From: "L�onie Watson" <tink@xxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Mon, 4 May 2009 22:15:55 +0100

        The code for the script and reverse script is in the virtual.jss
file. Code for both is below:

Script MoveToNextAccessibilityLink ()
var
string sAttributeValue,
string sAccessibilityAttributeValue,
string sLinkDescription,
string sLinkList

let sAttributeValue = "rel=accessibility"
let sAccessibilityAttributeValue = "accessibility:"

;Check for virtual cursor.
if !IsVirtualPCCursor() then
        SayQuickKeynavigationNotAvailable()
        return
endIf

;Create a list of links with the rel attribute.
let sLinkList = GetListOfTagsWithAttribute ("A", "rel", true, "|",
GetCurrentWindow(), true)

;Check whether the accessibility attribute value is present in the list.
If StringContains(sLinkList, sAccessibilityAttributeValue) then

        ;If the accessibility attribute value is present, move to the next
link with the rel attribute and get its description.
        MoveToTagWithAttribute (S_NEXT, "A", "rel")
        let sLinkDescription = GetElementDescription (0, false)

        ;Whilst the link description does not include the accessibility
attribute value, repeat the process.
While !StringContains(sLinkDescription, sAttributeValue)
                MoveToTagWithAttribute (S_NEXT, "A", "rel")
                let sLinkDescription = GetElementDescription (0, false)
        EndWhile

        ;If the link description does include the accessibility attribute
value, speak the link text.
        If StringContains(sLinkDescription, sAttributeValue) then
                SayLine()
        EndIf

;Otherwise, if the accessibility attribute value is not present in the list,
or if the list is blank, speak notification message.
ElIf !StringContains(sLinkList, sAccessibilityAttributeValue) ||
StringIsBlank (sLinkList) then
        SayFormattedMessage(OT_NO_DISABLE, msgNoAccessibilityLinks_L,
msgNoAccessibilityLinks_S)
EndIf

EndScript


Script MoveToPriorAccessibilityLink ()
var
string sAttributeValue,
string sAccessibilityAttributeValue,
string sLinkDescription,
string sLinkList

let sAttributeValue = "rel=accessibility"
let sAccessibilityAttributeValue = "accessibility:"

;Check for virtual cursor.
if !IsVirtualPCCursor() then
        SayQuickKeynavigationNotAvailable()
        return
endIf

;Create a list of links with the rel attribute.
let sLinkList = GetListOfTagsWithAttribute ("A", "rel", true, "|",
GetCurrentWindow(), true)

;Check whether the accessibility attribute value is present in the list.
If StringContains(sLinkList, sAccessibilityAttributeValue) then

        ;If the accessibility attribute value is present, move to the prior
link with the rel attribute and get its description.
        MoveToTagWithAttribute (S_PRIOR, "A", "rel")
        let sLinkDescription = GetElementDescription (0, false)

        ;Whilst the link description does not include the accessibility
attribute value, repeat the process.
While !StringContains(sLinkDescription, sAttributeValue)
                MoveToTagWithAttribute (S_PRIOR, "A", "rel")
                let sLinkDescription = GetElementDescription (0, false)
        EndWhile

        ;If the link description does include the accessibility attribute
value, speak the link text.
        If StringContains(sLinkDescription, sAttributeValue) then
                SayLine()
        EndIf

;Otherwise, if the accessibility attribute value is not present in the list,
or if the list is blank, speak notification message.
ElIf !StringContains(sLinkList, sAccessibilityAttributeValue) ||
StringIsBlank (sLinkList) then
        SayFormattedMessage(OT_NO_DISABLE, msgNoAccessibilityLinks_L,
msgNoAccessibilityLinks_S)
EndIf

EndScript

        The messages are in the .jsm files for IE and Firefox respectively.
The key mappings are in the application specific .jkm files. Actually, I've
just realised I still have the key mappings in default.jkm as well, which
I'll need to correct!

        I'm going to be away from my computer until Wednesday now, but if
you get a chance to test, that would be excellent. Thanks.

Léonie.


--
http://www.tink.co.uk/

Email: tink@xxxxxxxxxx
Twitter: LeonieWatson

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Haden Pike
Sent: 04 May 2009 21:33
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Element attribute values.

Hi Léonie. I have put your script in vertual.jss and the script key in
default.jkm. Where did you place the messages? I am asking so I don't do
anything differently than you did so I can test it. Also, have you written a
reverse script for it?
Haden

--------------------------------------------------
From: "Léonie Watson" <tink@xxxxxxxxxx>
Sent: Monday, May 04, 2009 1:16 PM
To: <jawsscripts@xxxxxxxxxxxxx>
Subject: [jawsscripts] Re: Element attribute values.

> Thanks Chad, I've done as you suggest and put some handling in for
> pages that don't have any links with the given attribute/value combo.
> The script is working well in IE now, but I'm having some trouble with
> Firefox.
>
> On pages where there are no links with the given attribute/value
> combo, the script works well in Firefox. But, on pages where there are
> links with this attribute/value combo, I'm getting an unknown function
> call to SaySelectedLink4().
>
> Looking through the list of built in functions, I now can't find this
> function at all! I must have come across it somewhere, but where
> escapes me for the moment. In any case, it appears to be working with
> IE if nothing else. Any ideas about Firefox at all?
>
> The script code added to the virtual.jss file is here:
>
> Script MoveToNextAccessibilityLink ()
> var
> string sAttributeValue,
> string sAccessibilityAttributeValue,
> string sLinkDescription,
> string sLinkList
>
> let sAttributeValue = "rel=accessibility"
> let sAccessibilityAttributeValue = "accessibility:"
>
> ;Check for virtual cursor.
> if !IsVirtualPCCursor() then
> SayQuickKeynavigationNotAvailable()
> return
> endIf
>
> ;Create a list of links with the rel attribute.
> let sLinkList = GetListOfTagsWithAttribute ("A", "rel", true, "|",
> GetCurrentWindow(), true)
>
> ;Check whether the accessibility attribute value is present in the list.
> If StringContains(sLinkList, sAccessibilityAttributeValue) then
>
> ;If the accessibility attribute value is present, move to the next
> link with the rel attribute and get its description.
> MoveToTagWithAttribute (S_NEXT, "A", "rel") let sLinkDescription =
> GetElementDescription (0, false)
>
> ;Whilst the link description does not include the accessibility
> attribute value, repeat the process.
> While !StringContains(sLinkDescription, sAttributeValue)
> MoveToTagWithAttribute (S_NEXT, "A", "rel") let sLinkDescription =
> GetElementDescription (0, false) EndWhile
>
> ;If the link description does include the accessibility attribute
> value, speak the link text.
> If StringContains(sLinkDescription, sAttributeValue) then
> SaySelectedLink4()
> EndIf
>
> ;Otherwise, if the accessibility attribute value is not present in the
> list, or if the list is blank, speak notification message.
> ElIf !StringContains(sLinkList, sAccessibilityAttributeValue) ||
> StringIsBlank (sLinkList) then SayFormattedMessage(OT_NO_DISABLE,
> msgNoAccessibilityLinks_L,
> msgNoAccessibilityLinks_S)
> EndIf
> EndScript
>
> The code added to the InternetExplorer.jkm and Firefox.jkm files is:
>
> [Quick Navigation Keys]
> 8=MoveToNextAccessibilityLink
>
> The page I've been testing on, which has several links with the given
> attribute/value combo, is:
> http://www.tink.co.uk/
>
> If you can shed any light on the Firefox problem, that would be
> fabulous. Also, if you take one look at the above code and think it's
> an utter mess, I'd welcome any feedback that would help the script be
> more efficient and/or robust. Thanks.
>
> Léonie.
>
>
>
>
> --
> http://www.tink.co.uk/
>
> Email: tink@xxxxxxxxxx
> Twitter: LeonieWatson
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Chad Foster
> Sent: 04 May 2009 14:26
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: Element attribute values.
>
> No problem - glad to help. To make this available across browsers and
> platforms, the key assignments need to go into Default.jkm, and I
> recommend placing them in the [Quick Navigation Keys] section. Also, I
> would find an alternative assignment as has already been suggested.
> Perhaps something along the lines of 8 and SHIFT+8.
> If you dump these assignments into a section other than Quick
> Navigation Keys, then you will need to insert some logic for
> determining/ensuring we are using the Virtual PC Cursor, and we are in an
IE_Server window.
>
> Also, I would suggest placing some messages in your script in the
> event that no navigation has occurred e.g. no accessibility links are
> found. And I believe that anchors should be in all upper-case if
> memory serves correct, but you say it is working so it should be okay,
> but I would make them the proper case as a safety net.
>
>
> HTH,
>
> Chad
>
>
>
>
> On 5/4/09, Sean Randall <seanr@xxxxxxxxxxxxxxx> wrote:
>> Léonie,
>>
>> The  "use virtual.jsb" statement appears in default.jss, which makes
>> everything in virtual available in default.
>> The trick is that whereas keys on scripts are usually either assigned
>> to common, desktop, or laptop keyboard layouts, these scripts are
>> assigned
> to
>> "quick keys".   I'm assuming that whenever the virtual cursor is on and
>> focus is in an  appropriate web-based control (i.e. a web page, chm
>> window, pdf document etc) then  these keys become active.
>>
>> This means that keys like "e" for edit and "f" for form don't get
>> triggered in general circumstances but are available when the cursor
>> mode
> is right.
>> You could manually edit the JKM file to amend your chosen keystrokes
>> to this section; which is what I ended up doing for Thunderbird.  In
>> that instance I edited thunderbird and not default, of course, so for
>> instance in normal cases F moved between form fields but only in
>> thunderbird did F move to the next unread message, or whatever the
>> key was
> supposed to do.
>>
>> If you're customizing for the web you may want to decide whether
>> you're aiming for a "global" virtual change, or just a "browser"  one
>> (where you'd modify firefox and IE rather than everything).  The
>> latter means that you might not grab all browsers that render in
>> standard HTMl controls (perhaps some chm reference materials would
>> use the accessibility value and you'd have missed out). On the other
>> hand, you'd be ading an extra key to everywhere virtual pc is used,
>> which might
> not be what you want.
>>
>>
>>
>> Hope that clarifies some, shout at me if not...
>> Sean.
>>
>> -----Original Message-----
>> From: jawsscripts-bounce@xxxxxxxxxxxxx
>> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Léonie Watson
>> Sent: 04 May 2009 01:20
>> To: jawsscripts@xxxxxxxxxxxxx
>> Subject: [jawsscripts] Re: Element attribute values.
>>
>> I've had a look at the virtual.jss file Sean, thanks. It makes sense
>
>> for me to include these scripts in there, given what I'm trying to
>> accomplish. I'm a bit puzzled as to how it would work in practice though.
>>
>> Looking at a couple of scripts within the virtual.jss file, I
> noticed
>> that although they are checked to accept a key command, they don't
>> have them assigned. Looking at the InternetExplorer.jss file, I
>> noticed that it uses the "Use" statement to reference the virtual.jsb
>> file, so assume this is how the connection between the two is made.
>>
>> Am I right in thinking that all the scripts in the virtual.jsb file
>> are then available to the InternetExplorer.jss file? If so, how does
>> the key mapping fit in? Sorry for all the questions!
>>
>> This script is an exercise to support a suggestion that has been
> made
>> to the HTML 5 working group. The HTML 5 specification is being
>> developed at the moment, and someone has suggested that an additional
>> value for the rel="" attribute be included: accessibility.
>>
>> The idea being that web developers could include the attribute/value
>
>> combination on their pages, to reference links or other elements
>> related to accessibility. The HTML 5 working group prefer that there
>> is a working case for ideas, before they're added to the
>> specification. A group from the web standards community are putting
>> together some test cases and working examples, to see whether the
>> idea has
> any real life application.
>>
>> Léonie.
>>
>> --
>> http://www.tink.co.uk/
>>
>> Email: tink@xxxxxxxxxx
>> Twitter: LeonieWatson
>>
>>
>> __________
>> Visit and contribute to The JAWS Script Repository
>> http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> //www.freelists.org/list/jawsscripts
>>
>>
>
>
> --
> Chad Foster
> Access Technology Solutions
> Leveling The Playing Field Through Technology http://www.GO-ATS.net
> __________ Visit and contribute to The JAWS Script Repository
> http://jawsscripts.com
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4052 (20090504) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________
> Visit and contribute to The JAWS Script Repository
> http://jawsscripts.com
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
>
__________
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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



__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4052 (20090504) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: