PaackEng/paack-ui/6.2.0

NOTE: the latest version is 7.23.0

UI.Utils.Focus

Unified configuration for managing focus on components.

Configuration

type alias Focus msg =
{ onEnter : msg
, tabIndex : Int
, hasFocus : Bool
}

Required configuration for managing focus.

{ onEnter = Msg.OnFocusEnterThisComponent
, tabIndex = 2
, hasFocus = False
}

hasFocus can be used for enforcing focus when loading a new page.

Element Attributes

toElementAttributes : Focus msg -> List (Attribute msg)

Applies [Focus]#Focus into Elm UI attributes.

Element.el [ focusAttributes someConfig ] <|
    Element.text "Some content"