Modal trigger does not regain focus after closing

After closing a modal, the modal trigger does not regain focus.
I see problems in UX and especially accessibility.

Unfortunately, this has not been addressed to date.
The way the new nav block modal works is on point and exactly the way the modal block should behave as well.

Why is this even more important with the modal block?

After closing the modal, the user is not able to target the next focusable element which follows the modal trigger, since the focus is somewhere else.

Hi @Marius,

Thank you for bringing this to our attention, apologies for not addressing it sooner.

We have recognised the importance of this, and will have a fix for this when possible.

Sorry for the inconvenience.

1 Like

Thank you for letting me know, @Araminta.
No worries, since there wasn’t a dedicated report up until now.

Hello @Marius,

Thank you for this important remark.
We’ve addressed a potential fix in 1.2.9.8.

I’d be grateful if you could let me know if this helps fix the issue on your end.

Cheers,

Hey @Louis.

Thanks a lot for addressing this - greatly appreciated. That was quite important to me.

I can confirm that it works perfectly now.
When opening the modal, the modals’ closing element receives auto-focus when implemented accordingly, when closing the modal the same happens vice versa.

When testing, I came across some weird behaviour.
Tested with and without the button, so it seems like a menu issue.
It appears that it was introduced with this change, in the beta it seems to be fine.
Maybe you can have a look at it.

Hello @Marius,

Thanks for confirming this.

What you’re experiencing does seem odd. Can you see if you have the same behaviour here: Home – cwiclydemo

Cheers,

That works fine @Louis.

The tabindex of the menu items seem to be stuck (not updating accordingly) after the first cycle on my side.
So it skips to the last element (tabindex="0"), whereas the previous ones remain at -1.

Will test it on another installation and update here.

Edit:
Could you try to place the close icon outside of the columns?
I did that inside the browser tools of your demo and got the same result as on my side.

image

That’s also my exact setup when this behaviour appears.

Hi @Marius,

Thank you for the specifics here.

Indeed, I can confirm this behaviour when the menu is the first element in its parent. I do also believe this doesn’t bear any relation with the latest updates, although I will be checking on previous versions.

This is definitely a bug with the Menu block focusing logic.
Nice find!

1 Like

You could be right here. I was probably testing with a different block structure (possibly the same like yours, directly from the library) on the other installation. Sorry for the confusion.
Your demo put me on the right track though :+1:

Thank you for bringing this to our attention, @Marius :wink:

This should now be fixed with 1.2.9.8.2.

Please don’t hesitate to let us know if you experience any further trouble with this, by responding to this thread!

1 Like