aratcliffe/Leaflet.contextmenu

[accessibility] Delegate focus when context menu has been opened

Opened this issue · 2 comments

It'd be a great accessibility improvement for keyboard users if focus was delegated to the context menu's container.

https://developers.google.com/web/fundamentals/accessibility/a11y-for-teams#managing_focus:

When you change the content of the page, it's important to direct the user's attention by moving focus. A classic example of when this technique is useful is when opening a modal dialog. If a user relying on a keyboard presses a button to open a dialog and their focus is not moved into the dialog element, then their only course of action is to tab through the entire site until they eventually find the new control. By moving focus into the new content as soon as it appears, you can improve the efficiency of these users’ experiences.

A negative tabindex can be used to enable programmatic focus to the context menu's container:

https://webaim.org/techniques/keyboard/tabindex#zero-negative-one:

tabindex="-1" allows that element to receive programmatic focus. This means focus can be set to it using focus() scripting.

I would recommend adding highlights too, see mentioned issue. (These should be present with or without #136.)