zestia / ember-modal-dialog

🔲 Animatable modal dialogs for Ember apps
MIT License
10 stars 2 forks source link

Pressing tab from the URL will not focus on the first element in the dialog #7

Closed onin-baylen closed 3 years ago

onin-baylen commented 3 years ago

While you have a dialog open, if you click on the URL bar and try to tab from it, it will not go to the first focusable element in your dialog.

Using as your demo as a sample (https://zestia.github.io/ember-modal-dialog/) from the URL textbox, when I click on tab, it will go to the "Fork me on Github" even when the dialog is open.

amk221 commented 3 years ago

Hi 👋

What OS and what browser are you using?

For me, if I am in the URL bar, and I press tab, focus moves to the buttons in my toolbar, and, if I keep tabbing, eventually it will focus the document.

I suppose it could be expected that the modal dialog would be focused, but I wouldn't expect it to go to the first focusable element in the dialog. Because that is the choice of the developer, not the addon. (For example, the addon does not attempt to focus any elements for you when opened - you would do that with autofocus).

Have you seen this desired behaviour elsewhere?

onin-baylen commented 3 years ago

I'm using Windows 10 and a Google Chrome Browser.

I'm not using a mouse here (except on clicking the address bar), then I just press tab. As you can see, the checkbox has been focused. Of course if the focus arrives on an item in the dialog, it will trap the focus on the elements in the dialog afterwards.

image

onin-baylen commented 3 years ago

If this is something that is expected. Or something that the developer has to implement, then I will close this one.

amk221 commented 3 years ago

Ok, it seems to be a Windows thing. I'll see what I can do...

amk221 commented 3 years ago

Hi, can you please test 3.1.0-beta.0

onin-baylen commented 3 years ago

Seems to be working, although it takes two tabs to get to the the first focusable item in the dialog. So I don't know where the focus is after pressing the first tab. But once you hit tab again its focus is moved to the first focusable item in my dialog.

amk221 commented 3 years ago

Yeh, that seems right to me.

amk221 commented 3 years ago

I've had a change of heart on this, I think you're right.

Seeing as though the modal has effectively replaced the usable document beneath, then it should behave as if it were the document. Fixed in 3.1.0