code.pyret.org icon indicating copy to clipboard operation
code.pyret.org copied to clipboard

Rename dialog box should have sensible focus/key defaults

Open schanzer opened this issue 7 years ago • 5 comments

When the rename modal pops up, the filename field should have focus (if not already be selected!). ESC and Enter should have the effect of canceling-and-closing or saving-and-closing, respectively.

schanzer avatar Aug 06 '18 17:08 schanzer

Adding myself to this issue as I plan to address modal content/styling and focus/keyboard stuff.

asolove avatar May 19 '21 07:05 asolove

FYI - I've recently learned that screenreaders expect the title of any modal to receive focus first.

schanzer avatar May 20 '21 01:05 schanzer

It's a bit tricky! Focus should move into the modal and the title should be readable immediately, but that can be done in other ways than receiving focus. Focus is also supposed to stay "trapped" in the modal, so you can't tab to anything else.

asolove avatar May 20 '21 01:05 asolove

Blind users rely on the screenreader, and the screenreader relies on focus. The convention, apparently, is to set aria-hidden=true on the body element to make it inaccessible to screenreaders, but then false on the modal. But focusing on the title seems to be a requirement - and it's only one Tab away from the file name.

schanzer avatar May 20 '21 01:05 schanzer

Hmm, reading the WAI-ARIA example from the spec, linked above, I think that's not quite right. The title isn't a focusable element, but it should be given ARIA attributes such that it is read out when the modal becomes available, and the first focusable element should be focusable to be read after that.

On Thu, May 20, 2021 at 9:15 AM Emmanuel Schanzer @.***> wrote:

Blind users rely on the screenreader, and the screenreader relies on focus. The convention, apparently, is to set aria-hidden=true on the body element to make it inaccessible to screenreaders, but then false on the modal. But focusing on the title seems to be a requirement - and it's only one Tab away from the file name.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/brownplt/code.pyret.org/issues/284#issuecomment-844606991, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACCL72IDPW3S5R5FQWRTTTORPEHANCNFSM4FOC7K3A .

asolove avatar May 20 '21 01:05 asolove