Open backwardok opened 6 years ago
As commented in #99, we seem to be running into is a random result in the 'return to last focus state' where VoiceOver, if it can't find/remember the state for whatever reason, will default to a focusable element nearest the last press being the close button of the modal.
What JavaScript we've tested so far doesn't seem to have much difference as VoiceOver will make its own decisions on where to go and ignore what we're asking it to do.
In short, needs more work but the issue is understood. Contribution on this from anyone is very welcome.
For this one, you likely need to pass in a reference to the opening element (or actually keep track of what opened it when it triggers the modal) to explicitly focus that element (instead of activeElement
) since iOS Safari doesn't seem to track <button>
s as active.
Thanks @backwardok - we already do keep track of the original element at the point the modal is triggered to open, only it hasn't been used by VoiceOver correctly or as expected. The replies to #99 have given us a good base and reference point to work from, so we expect to have updates to this task as well rolled into that. Thanks again!
Issue
Steps to reproduce:
What's expected: VO focus moves back to the Show Modaal button
What happens: VO focus is at the end of the page (where the modal previously existed)
What's going on
MDN's activeElement documentation mentions that on a Mac, this may only work with text inputs. I found that this is only true on iOS and not on the Mac. If you are on a button that's focused and you query for
activeElement
, it doesn't return anything.