NoRedInk/noredink-ui/23.0.1

NOTE: the latest version is 35.9.3

Nri.Ui.QuestionBox.V3

view : List (Attribute msg) -> Html msg
QuestionBox.view
    [ QuestionBox.markdown "**WOW**, great component!"
    ]
type Attribute msg
id : String -> Attribute msg
markdown : String -> Attribute msg
List
{ label : String
, onClick : msg
}
-> Attribute msg
Maybe
{ name : String
, icon : Svg
}
-> Attribute msg

This is the default type of question box. It doesn't have a programmatic or direct visual relationship to any piece of content.

String
-> Maybe
{ block : Element
, paragraph : Element
, questionBox : Element
}
-> Attribute msg

This type of QuestionBox has an arrow pointing to the block whose id you pass in, if that block is on the final line of its paragraph. The QuestionBox should be vertically aligned beneath the block, viewport permitting.

Pass in the id for the block the QuestionBox should point to.

You will need to pass 2 measurements, taken using Dom.Browser, in order for the question box to be positioned correctly.

containerCss : List Style -> Attribute msg
setLeftActions : Html msg -> Attribute msg

Adds an arbitrary HTML on the left of the question box for the text to speech button

guidanceId : String -> String

This helper is how we create an id for the guidance speech bubble element based on the QuestionBox.id value. Use this helper to manage focus.

When showing multiple questions in a sequence based on the user's answer, we want to move the user's focus to the guidance so that:

  • Screenreader users are alerted to a new context -- the new question!
  • Keyboard users's focus is somewhere convenient to answer the question (but not on an answer, since we don't want accidental submissions or for the user to hit enter straight and miss the guidance!)

Modules