I have a modal popup opened. I have accessibility requirement. So added ARIA related labels. But when i click tab key continuously focus going to the page behind the actual page.
Added role="dialog" in html file
But when modal opened i want only the focus navigate within the modal popup.
Working on Angular4, HTML5
project. Better if we find a solution within HTML file itself. I mean without added any javascript/jQuery related stuffs to prevent this
You are asking about focus trap, it's nicely demonstrated in this demo: http://davidtheclark.github.io/focus-trap/demo/
Adding role="dialog"
will not automatically provide trap the focus within that element. In fact, there's no native focus trap provided by browsers.
You need to go with one of following options: