Closed Bug 1574428 Opened 3 months ago Closed 3 months ago

IAccessible2_2::get_relationTargetsOfType only fetches one target when maxTargets is 0

Categories

(Core :: Disability Access APIs, defect, P2)

68 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla70
Tracking Status
firefox-esr68 --- affected
firefox69 --- fixed
firefox70 --- fixed

People

(Reporter: alderuijter, Assigned: Jamie)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

I'm looking at implementing basic aria-controls support in NVDA, see https://github.com/nvaccess/nvda/issues/8983

I intended to use IAccessible2_2::get_relationTargetsOfType for this.

I called get_relationTargetsOfType as follows:

  • relation: "controllerFor"
  • maxTargets: 0, 1, 2, 3 and 4

Thereby, I was using the following snippet, calling get_relationTargetsOfType on the first element:

<p aria-controls="a b c">controller</p><p id="a">a</p><p id="b">b</p><p id="c">c</p>

Actual results:

For maxtargets = 0, nTargets was 1. for maxTargets = 1, nTargets was 2, for maxtargets = 2, nTargets was 3

Expected results:

For maxtargets = 0, nTargets should be 3 in this case. for maxTargets = 1, nTargets should be 1, for maxtargets = 2, nTargets should be 2.

Putting into right component and confirming.

Status: UNCONFIRMED → NEW
Component: Untriaged → Disability Access APIs
Ever confirmed: true
Product: Firefox → Core
Assignee: nobody → jteh
Priority: -- → P2

STR (with the NVDA screen reader):

  1. Open this test case:
    data:text/html,<p aria-controls="a b c">controller</p><p id="a">a</p><p id="b">b</p><p id="c">c</p>
  2. Focus the document.
  3. Open the NVDA Python Console by pressing NVDA+control+z.
  4. Paste the following code:
    import IAccessibleHandler as iah
    i = focus.firstChild.IAccessibleObject.QueryInterface(iah.IAccessible2_2)
    for maxTargets in range(5):
        i.relationTargetsOfType("controllerFor", maxTargets)[1]
    
  5. Press enter twice.
    • Expected: On separate lines, the numbers 3, 1, 2, 3, 3
    • Actual: On separate lines, the numbers 1, 2, 3, 3, 3
  1. As per the spec, if maxTargets is 0, return all targets.
  2. Where maxTargets > 0, fix the loop condition so it doesn't incorrectly fetch one more target than requested.
Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/38459b4f9d63
IAccessible2_2::relationTargetsOfType: Support 0 for all targets and fix off-by-one error. r=MarcoZ
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Thanks for fixing this that quickly!

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=995230 against Chromium, since it has a similar off by one error bug.

Verified fixed in build 70.0a1 (20190819095406).

Status: RESOLVED → VERIFIED

Comment on attachment 9086316 [details]
Bug 1574428: IAccessible2_2::relationTargetsOfType: Support 0 for all targets and fix off-by-one error.

Beta/Release Uplift Approval Request

  • User impact if declined: Incorrect reporting of relations in accessibility clients such as screen readers.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Trivial patch which only affects a specific function called by Windows accessibility clients.
  • String changes made/needed: None.
Attachment #9086316 - Flags: approval-mozilla-beta?

Comment on attachment 9086316 [details]
Bug 1574428: IAccessible2_2::relationTargetsOfType: Support 0 for all targets and fix off-by-one error.

Windows a11y fix. Approved for 69.0b16.

Attachment #9086316 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.