NoRedInk / noredink-ui / Nri.Ui.FocusTrap.V1

Patch changes:

Create a focus trap.


type alias FocusTrap msg =
{ firstId : String
, lastId : String
, focus : String -> msg 
}

Defines how focus will wrap in reponse to tab keypresses in a part of the UI.

The ids referenced here are expected to correspond to elements in the container we are applying the focus trap on.

toAttribute : FocusTrap msg -> Accessibility.Styled.Attribute msg

Attach this attribute to add a focus trap to an HTML element.