Bug 253957 - [iOS VoiceOver] document.activeElement cannot point to a button that has attribute aria-haspopup
Summary: [iOS VoiceOver] document.activeElement cannot point to a button that has attr...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 16
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-03-15 05:30 PDT by Aaron Hakala
Modified: 2023-03-15 06:50 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Hakala 2023-03-15 05:30:37 PDT
# Summary

When using iOS VoiceOver with Safari/Chrome the `document.activeElement` is not pointing to a button that has the attribute `aria-haspopup` instead it returns the `body` element. Removing this attribute causes the the `document.activeElement` to point to the button.

I guess this issue might be a symptom of some other focus handling logic.

# Example situation

1. A button opens a modal/dialog. This element is recorded by using the `document.activeElement`.
2. Modal captures focus.
3. When modal is closed the focus is returned to the element that opened the modal.

If the button has the attribute `aria-haspopup` the `document.activeElement` points to `body` instead of the `button`.

Example codepen: https://codepen.io/aaronkala/pen/wvEmeZL

# Expected behaviour

The `document.activeElement` points to the `button` even if it contains the `aria-haspopup` attribute.
Comment 1 Radar WebKit Bug Importer 2023-03-15 05:30:48 PDT
<rdar://problem/106751475>