nrkno / core-components

Accessible and lightweight Javascript components
https://static.nrk.no/core-components/latest/
MIT License
117 stars 10 forks source link

Focus control in core-dialog inclueds elements with tabindex=-1 #645

Closed mittinatten closed 2 years ago

mittinatten commented 2 years ago

If you have a dialog with a tabindex=-1 heading first and tab past the last element, you circle back to the heading, which should not be keyboard focusable.

I guess an easy fix would be to change [tabindex] (here: https://github.com/nrkno/core-components/blob/master/packages/core-dialog/core-dialog.js#L3) to [tabindex]:not([tabindex="-1"]

mittinatten commented 2 years ago

I guess one should add :not([disabled]), to most of the other elements too.