Don't report live regions in background tabs in Firefox#9634
Merged
Conversation
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.
michaelDCurran
approved these changes
May 31, 2019
Collaborator
|
@jcsteh commented on 29 May 2019, 05:43 CEST:
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? |
Contributor
Author
|
I wasn't actually aware we exposed IA2_STATE_ACTIVE on documents. However,
digging into this, it seems this is not really intentional and it doesn't
get exposed on documents hosted in the parent process like about:support,
about:config, etc. So I think we should leave this as is.
If you're interested in the details, we expose the active state on the root
accessible for the window if that window is active, as per the spec.
However, because content processes don't have a real window, the document
is a root accessible in that process and so that code applies to them.
|
Collaborator
|
Thanks for the clarification. Yes, go ahead with this as is :)
|
Collaborator
|
Thanks for this work! Very appreciated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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>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)