ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: Ionic 8+ produces Blocked aria-hidden on an element because its descendant retained focus

Open kevinclarkadstech opened this issue 10 months ago • 10 comments

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

Navigating back and forth with React Router tabs and pages produces the error: Blocked aria-hidden on an element because its descendant retained focus

If you open the StackBlitz for the IonTabs on the docs, it does not show this error message, because the Ionic version of the docs is 7. But, if you upgrade to the latest version of Ionic (8.4.2 at this time) it will start getting the error message.

https://ionicframework.com/docs/api/tabs

Have not tried it with frameworks other than React

Full error is

/home/profile:1 Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden. Element with focus: a Ancestor with aria-hidden:

Expected Behavior

The elements should lose focus before the transition of pages so Chrome does not produce the alert.

Steps to Reproduce

Go to https://ionicframework.com/docs/api/tabs and open the Stack Blitz. Look in the console as you navigate from Home to Profile and back. Notice no errors.

Upgrade the package json for ionic-react and ionic-react-router. Re-run the application and notice the console started producing logs.

Code Reproduction URL

https://zt5hvy-amge--5173--495c5120.local-credentialless.webcontainer.io/home/profile

Ionic Info

Ionic:

Ionic CLI : 5.4.16

Utility:

cordova-res : not installed native-run : not installed

System:

NodeJS : v18.20.3 npm : 10.2.3 OS : Linux 5.0

Additional Information

Thank you so much for creating a great framework! I love working with it and the HMR makes it a great DX. I have been following Ionic since v1.

I first noticed this on my own project and thought it was an issue with how I was implementing it til I noticed this only happens on Ionic 8+.

kevinclarkadstech avatar Mar 12 '25 01:03 kevinclarkadstech

The vue version will also appear

gitMarksa avatar Mar 12 '25 12:03 gitMarksa

The same thing happens in angular Image

Marius-Romanus avatar Mar 14 '25 12:03 Marius-Romanus

+1

ldikmans avatar Mar 19 '25 19:03 ldikmans

+1

Jodelopa avatar Mar 20 '25 10:03 Jodelopa

+1

AlexKolomiytsev avatar Mar 21 '25 14:03 AlexKolomiytsev

  • 1

check16 avatar Mar 21 '25 18:03 check16

+1

bielgirao avatar Mar 27 '25 17:03 bielgirao

+1, Angular

ricco-skombar avatar Apr 18 '25 11:04 ricco-skombar

+1 , Also in Angular

mfalto avatar Apr 18 '25 12:04 mfalto

I think it's related to this issue : https://github.com/ionic-team/ionic-framework/issues/30040

And there is a good explanation of why it happens here : https://github.com/ionic-team/ionic-framework/issues/30040#issuecomment-2598359140

TL;DR : it's due to an ARIA spec update and a fix should be made on the Ionic side

vdsbenoit avatar Apr 24 '25 09:04 vdsbenoit