NoRedInk/noredink-ui/22.12.1

NOTE: the latest version is 35.9.3

Nri.Ui.QuestionBox.V4

Patch Changes

  • Modified viewPointingTo to be hidden when measurements are Nothing to reduce the jitter of the question box moving to its correct position.
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
, container : Maybe 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. When there is a container the container will be used to calculate the offset from the viewport.

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

You will need to pass 4 measurements, taken using Dom.Browser, in order for the question box to be positioned correctly. The question box will be hidden the first time when you pass Nothing for the measurements to reduce the jitter of the question box moving to its correct position.

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