act-rules.github.io icon indicating copy to clipboard operation
act-rules.github.io copied to clipboard

"Programmatically Determined Link Context" definition is too broad

Open Jym77 opened this issue 1 year ago • 6 comments

The definition of Programmatically Determined Link Context includes all the containing paragraph (or block ancestor). This means that links inside the same paragraph cannot be disambiguated by their sentence, which is part of the note in the WCAG definition of programmatically determined link context:

Since screen readers interpret punctuation, they can also provide the context from the current sentence, when the focus is on a link in that sentence.

So,

<p>
 <a href="foo.html">Read more</a> about foo.
 <a href="bar.html">Read more</a> about bar.
<p>

fails the rule, but arguably passes the SC (not the best practice, but still correct) because the sentence provides the context.

Jym77 avatar Apr 10 '24 11:04 Jym77

@carlosapaduarte check if there is an "universal" objective of sentence

carlosapaduarte avatar Apr 16 '24 09:04 carlosapaduarte

It's worth noting that AT/UA support can be rather inconsistent for the situation pointed out by @Jym77.

For instance, when using VO + Chrome, pressing VO+S to announce the sentence results in it reading "about bar" regardless of whether it's the first or second "read more."

screenshot of VO on Chrome reads about bar, even though it should say about foo screenshot of VO on Chrome reads about bar correctly

However, when using VO + Safari, pressing VO+S correctly reads the sentence and its context.

screenshot of VO on Chrome reads read more about foo correctly screenshot of VO on Chrome reads read more about bar correctly

giacomo-petri avatar Apr 24 '24 08:04 giacomo-petri

CG decision (April 25th): make more test of AT/UA, then if the problem is generic, open issue with WCAG.

Jym77 avatar Apr 25 '24 14:04 Jym77

@Jym77,

I've created test cases and the results are provided below. Here's the rundown of the tests:

  • Example 1
    <h2>Example 1</h2>
    <div>
        <p>
            <a href="foo.html">Read more</a> about foo.
            <a href="bar.html">Read more</a> about bar.
        </p>
    </div>
    

    Read more about foo. Read more about bar.

  • Example 2
    <h2>Example 2</h2>
    <div>
        <p>
            <span><a href="foo.html">Read more</a> about foo.</span>
            <span><a href="bar.html">Read more</a> about bar.</span>
        </p>
    </div>
    

    Read more about foo. Read more about bar.

  • Example 3
    <h2>Example 3</h2>
    <div>
        <div><a href="foo.html">Read more</a> about foo.</div>
        <div><a href="bar.html">Read more</a> about bar.</div>
    </div>
    
    Read more about foo.
    Read more about bar.
  • Example 4
    <h2>Example 4</h2>
    <div>
        <a href="foo.html">Read more</a> about foo.
        <a href="bar.html">Read more</a> about bar.
    </div>
    
    Read more about foo. Read more about bar.
  • Example 5
    <h2>Example 5</h2>
    <div>
        <span role="paragraph"><a href="foo.html">Read more</a> about foo.</span>
        <span role="paragraph"><a href="bar.html">Read more</a> about bar.</span>
    </div>
    
    Read more about foo. Read more about bar.
  • Example 6
    <h2>Example 6</h2>
    <div>
        <p>
            <a href="foo.html">Read more</a> about foo, <a href="bar.html">read more</a> about bar.
        </p>
    </div>
    

    Read more about foo, read more about bar.

  • Example 7
    <h2>Example 7</h2>
    <div>
        <p>
            <a href="foo.html">Read more</a> about foo (<a href="bar.html">read more</a> about bar).
        </p>
    </div>
    

    Read more about foo (read more about bar).

Outcome:

  Example 1 Example 2 Example 3 Example 4 Example 5 Example 6 Example 7
VO + Chrome (paragraph - VO+P) “Read more” “Read more” “Read more” “Read more” “Read more” “Read more” “Read more”
VO + Chrome (sentence - VO+S) “Read more” “Read more” “Read more” “Read more” “Read more” “Read more” “Read more”
VO + Safari (paragraph - VO+P) Read more about foo. Read more about bar. Read more about foo. Read more about bar. [“Read more about foo.”, “Read more about bar.”] Read more about foo. Read more about bar. Read more about foo. Read more about bar. Read more about foo. Read more about bar. Read more about foo (read more about bar).
VO + Safari (sentence - VO+S) [“Read more about foo.”, “Read more about bar.”] [“Read more about foo. R”, “ut foo. R”] [“Read more about foo.”, “Read more about bar.”] [“Read more about foo.”, “Read more about bar.”] [“Read more about foo. R”, “foo. R”] Read more about foo. Read more about bar. Read more about foo (read more about bar).
NVDA + Firefox (Read current line) “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo. ” “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo, link read more about bar” “Link read more about foo (link read more about bar)”
NVDA + Chrome (Read current line) “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo. ” “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo, link read more about bar” “Link read more about foo (link read more about bar)”
NVDA + Edge (Read current line) “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo. ” “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo, link read more about bar” “Link read more about foo (link read more about bar)”
JAWS + Chrome (Say current line) “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more”
JAWS + Chrome (Say current sentence) “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more”
JAWS + Chrome (Say current paragraph) “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo.” “Link read more about foo. Link read more about bar” “Link read more about foo.” “Link read more about foo, link read more about bar” “Link read more about foo (link read more about bar)”
JAWS + Edge (Say current line) “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more”
JAWS + Edge (Say current sentence) “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more” “Link read more”
JAWS + Edge (Say current paragraph) “Link read more about foo. Link read more about bar” “Link read more about foo. Link read more about bar” “Link read more about foo.” “Link read more about foo. Link read more about bar” “Link read more about foo.” “Link read more about foo, link read more about bar” “Link read more about foo (link read more about bar)”

It appears that sentence support, which seems to be lacking in NVDA, isn't consistently reliable even when available.

I plan to bring up this issue on the WCAG GitHub in the next few days.

giacomo-petri avatar May 02 '24 09:05 giacomo-petri

@giacomo-petri I'd like to set my expectations for your examples. First, shouldn't there be an example without a div? I think it would be useful to confirm how a heading/paragraph construction alone behaves, since that is confirming the HTML paragraph structure.

Examples 1, 2, 6 and 7 seem valid to me. However, the defaults for punctuation reading by different screen readers will make 6 and 7 varied, and I would not consider variations based on punctuation to be relevant to a check for programmatic equivalent (since they are syntax indicators in the text itself).

Examples 3 and 4 seem malformed. They lack programmatic indicators of paragraph syntax. I'd consider these examples of code failing 1.3.1. Example 5 is misrepresenting the text presented to users. There is only one paragraph. This code should fail 1.3.1, right?

Given that, the only two of these examples I would expect to be really solid tests for cross-reader testing are 1 and 2.


In regards to your results, checking for line and sentence reading is interesting, but those are not things programmatically set by the author. So they seem irrelevant to a test for programmatic equivalence for WCAG conformance.

Based on that, I just checked the rows that had "paragraph" in the first cell. I'd say there is a potential bug in VO+Chrome (although the unique way VO handles links inside any chunk of text makes it a little hard to say what expected behaviour should be), and all the other combinations are reading the paragraph consistently.

mbgower avatar Jul 04 '25 15:07 mbgower

@Jym77

fails the rule, but arguably passes the SC (not the best practice, but still correct) because the sentence provides the context.

Which of the ACT rules is it failing? I didn't see a link to that when I scanned the issue. There is an issue open against WCAG to clarify the 'sentence' note in the "Programmatically indicated" definition, but remember that notes are informative.

mbgower avatar Jul 04 '25 17:07 mbgower