raster-foundry / blasterjs

React UI library designed and built by Azavea
https://raster-foundry-blaster.netlify.com
Other
6 stars 3 forks source link

Revisit Dialog focus treatment #213

Closed lederer closed 5 years ago

lederer commented 5 years ago

When a Dialog opens, the role="dialog" element automatically gains focus, and so has an outline, eg:

In practice, it's probably best for consumers to programmatically give focus to an interactive element within the Dialog when it opens. But we should consider revisiting the Dialog focus treatment for cases when that isn't done.

For a11y's sake, we should retain some indication of focus, but it can be opinionated.

Note: the Dialog focus can already be disabled by passing shouldFocusAfterRender={false} to the <Dialog>, but this leaves the focus on the button that triggered the dialog, which is outside the dialog boundaries and so creates havoc when attempting to navigate the open dialog by keyboard.