When content cannot be made accessible to assistive technologies, mostly screen readers, it is possible to hide it by putting aria-hidden="true" on the element container for that section.
This hides non-focusable content just fine, but what if the hidden content includes focusable elements?
Between the previousheading and the next heading there is a hidden section of content with two links and a piece of text. Screen readers should ignore those completely if the content is really and truly hidden.
Dummy link before hidden region Dummy Link after regionHere we list whether focusable and nonfocusable content of hidden region was announced using a screen reader. When navigating in browse mode (using arrow keys), and when navigating by the tab key (hitting focusable elements).
When there are no focusable elements inside the content, yes, it does.
When there are focusable elements inside the content, only works on Voiceover.
If these do not need to be accessible for a keyboard only user, put tabindex="-1" on all focusable elements, to make them non-focusable. Remember, accessibility is not just about screen reader, it is about all users, including those who can only use the keyboard.
Ultimately screen reader vendors (NVDA and Jaws) need to follow the Voiceover example and truly remove all hidden content, including focusable elements, from the screen reader version of the webpage.
A somewhat clumsy workaround is to put tabindex="-1" on all elements in hidden region by default. But offer a button on the page that, when activated, puts these elements back in the focus order (by removing tabindex="-1").