Skip to content

Don't report live regions in background tabs in Firefox#9634

Merged
michaelDCurran merged 2 commits into
nvaccess:masterfrom
jcsteh:ffBgLiveRegionI1318
Jun 3, 2019
Merged

Don't report live regions in background tabs in Firefox#9634
michaelDCurran merged 2 commits into
nvaccess:masterfrom
jcsteh:ffBgLiveRegionI1318

Conversation

@jcsteh

@jcsteh jcsteh commented May 29, 2019

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #1318.

Summary of the issue:

In Firefox, live region updates are incorrectly reported even when the region is in a background tab.

Description of how this pull request fixes the issue:

In Firefox, all tabs have the same HWND. Objects in background tabs do get the offscreen state, but offscreen live regions are used to report visually hidden information, so we can't filter based on that. Therefore, if the offscreen state is set, we do an additional background check. We get the tab document from the accessible, get the foreground tab document and compare them. If they differ, the event is for a background tab and we thus ignore the event.

Testing performed:

All tests completed in both Firefox and Chrome.

Test case 1 (on-screen live region):
data:text/html,<div id="live" aria-live="polite">Initial content</div><script>setTimeout(() => live.textContent = "Updated live content", 2000);</script>

  1. Opened the test case and waited 2 seconds. Confirmed that NVDA said "Updated content".
  2. Opened the test case and immediately hit control+t to open a new tab. Confirmed that NVDA did not say "Updated content" within 2 seconds. (This test fails in Firefox without this patch.)

Test case 2 (off-screen live region):
data:text/html,<div id="live" aria-live="polite" style="position: absolute; left: -1000px;">Initial content</div><script>setTimeout(() => live.textContent = "Updated live content", 2000);</script>

Same tests as for test case 1. I wanted to verify that the presence of the offscreen state didn't cause unexpected problems, since the new code runs in this case.

Known issues with pull request:

In theory, this could impact performance, as there are a few additional COM calls for off-screen live regions. However, I don't believe this is a concern in practical terms.

Change log entry:

Bug fixes:

- In Mozilla Firefox, updates to a live region are no longer reported if the live region is in a background tab. (#1318)

In Firefox, all tabs have the same HWND.
Objects in background tabs do get the offscreen state, but offscreen live regions are used to report visually hidden information, so we can't filter based on that.
Therefore, if the offscreen state is set, we do an additional background check.
We get the tab document from the accessible, get the foreground tab document and compare them.
If they differ, the event is for a background tab and we thus ignore the event.
@jcsteh jcsteh requested a review from michaelDCurran May 29, 2019 03:43
@LeonarddeR

Copy link
Copy Markdown
Collaborator

@jcsteh commented on 29 May 2019, 05:43 CEST:

Therefore, if the offscreen state is set, we do an additional background check. We get the tab document from the accessible, get the foreground tab document and compare them. If they differ, the event is for a background tab and we thus ignore the event.

Quick inspection revealed that the document (not the property page) for the active tab has IA2_STATE_ACTIVE in Firefox. May be you can check for that and return true early?

@jcsteh

jcsteh commented Jun 3, 2019 via email

Copy link
Copy Markdown
Contributor Author

@LeonarddeR

LeonarddeR commented Jun 3, 2019 via email

Copy link
Copy Markdown
Collaborator

@michaelDCurran michaelDCurran merged commit a74796f into nvaccess:master Jun 3, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Jun 3, 2019
@Adriani90

Copy link
Copy Markdown
Collaborator

Thanks for this work! Very appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updates incorrectly reported for lie regions in background tabs in Firefox

5 participants