FireFox NVDA modal is reading Heading level 1 instead of trigger element when closing the modal

105 views Asked by At

i was trying to implement a modal and i was making the modal accessible.But i observed that when im closing the modal in NVDA with firefox it is reading as heading level1 view modal button but it should announce view modal button

Here is the modal i was trying to implement

https://gdkraus.github.io/accessible-modal-dialog/

1

There are 1 answers

0
slugolicious On

Looks like a bug with NVDA. It happens on Chrome too. Neither JAWS nor VoiceOver re-announce the heading on the main page when the dialog is closed.

If you look at the javascript for the example, when the dialog is displayed, the element that had focus before the dialog was displayed is saved.

function showModal(obj) {
  ...
  // save current focus
  focusedElementBeforeModal = jQuery(':focus');
  ...
}

And when the dialog is closed, focus is moved back to that element.

function hideModal() {
  ...
  // set focus back to element that had it before the modal was opened
  focusedElementBeforeModal.focus();
}

Not sure why NVDA is re-announcing the main <h1> on the main page when focus is moved back to the button. I would suggest reporting a bug to NVDA, https://github.com/nvaccess/nvda/issues