# 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.
<rdar://problem/106751475>