Opened 10 years ago
Closed 9 years ago
#33312 closed defect (bug) (wontfix)
WP a11y speak and iframes: doubled live regions
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.2 |
Component: | General | Keywords: | has-patch |
Focuses: | accessibility, javascript | Cc: |
Description
Whenever there is an iframe and the wp-a11y script is enqueued, the polite and assertive live regions get appended twice, the first time in the main body and the second time in the iframe's body. For example, this happens when the Plugin details modal opens, see screenshot below.
This should be definitely avoided, also because sometimes screen readers announce "alert" when the modal dialog's iframe loads. Live regions should be appended only to the top level body.
Attachments (1)
Change History (7)
#3
follow-up:
↓ 4
@
10 years ago
This happens because the wp-a11y.js
is loaded in both: the iframe and the main window.
This is the right way for that functionality to work. Keep in mind that iframes are pretty much same as separate windows/tabs, i.e. scripts from the main window do not run inside an iframe unless specifically designed to do so and meeting the "same origin" requirement.
If we don't need the "speak" functionality inside the iframe, we should stop loading the script there.
#4
in reply to:
↑ 3
@
9 years ago
Replying to azaozz:
If we don't need the "speak" functionality inside the iframe, we should stop loading the script there.
Yup it would be nice to don't load it in the first place, in this case it's a dependency of updates.js
which is loaded both in the main document and in the iframe. Not sure what to do here.
The proposed patch introduces a check for
window.frameElement
, not sure it's the best method to use here, feedback and suggestions welcome.