@@ -330,6 +330,8 @@ The `onPress` handler will be fired either `onClick` or when the element is focu
330330 , label = text "My Button"
331331 }
332332
333+**Note** If you have an icon button but want it to be accessible, consider adding a [`Region.description`](Element-Region#description), which will describe the button to screen readers.
334+
333335-}
334336button :
335337 List (Attribute msg)
@@ -367,7 +369,17 @@ button attrs { onPress, label } =
367369
368370 Just msg ->
369371 Events.onClick msg
370− :: onEnter msg
372+ :: onKeyLookup
373+ (\code ->
374+ if code == enter then
375+ Just msg
376+
377+ else if code == space then
378+ Just msg
379+
380+ else
381+ Nothing
382+ )
371383 :: attrs
372384 )
373385 )
@@ -445,22 +457,24 @@ checkbox attrs { label, icon, checked, onChange } =
445457 ]
446458 ++ attrs
447459 in
448− applyLabel attributes
449− label
450− (Internal.element
451− Internal.asEl
452− Internal.div
453− [ Internal.Attr <|
454− Html.Attributes.attribute "role" "checkbox"
455− , Internal.Attr <|
456− Html.Attributes.attribute "aria-checked" <|
460+ applyLabel
461+ (Internal.Attr (Html.Attributes.attribute "role" "checkbox")
462+ :: Internal.Attr
463+ (Html.Attributes.attribute "aria-checked" <|
457464 if checked then
458465 "true"
459466
460467 else
461468 "false"
462− , hiddenLabelAttribute label
463− , Element.centerY
469+ )
470+ :: hiddenLabelAttribute label
471+ :: attributes
472+ )
473+ label
474+ (Internal.element
475+ Internal.asEl
476+ Internal.div
477+ [ Element.centerY
464478 , Element.height Element.fill
465479 , Element.width Element.shrink
466480 ]
@@ -699,7 +713,7 @@ slider attributes input =
699713 ("input[type=\"range\"]." ++ className ++ "::-ms-thumb")
700714 thumbShadowStyle
701715 )
702− , Internal.Attr (Html.Attributes.class (className ++ " focusable-parent"))
716+ , Internal.Attr (Html.Attributes.class (className ++ " ui-slide-bar focusable-parent"))
703717 , Internal.Attr
704718 (Html.Events.onInput
705719 (\str ->
@@ -765,10 +779,10 @@ slider attributes input =
765779 -- This is after `attributes` because the thumb should be in front of everything.
766780 ++ [ Element.behindContent <|
767781 if vertical then
768− viewVerticalThumb factor thumbAttributes trackWidth
782+ viewVerticalThumb factor (Internal.htmlClass "focusable-thumb" :: thumbAttributes) trackWidth
769783
770784 else
771− viewHorizontalThumb factor thumbAttributes trackHeight
785+ viewHorizontalThumb factor (Internal.htmlClass "focusable-thumb" :: thumbAttributes) trackHeight
772786 ]
773787 )
774788 Element.none
@@ -1551,6 +1565,8 @@ email =
15511565
15521566By default it will have a minimum height of one line and resize based on it's contents.
15531567
1568+Use `Element.spacing` to change its line-height.
1569+
15541570-}
15551571multiline :
15561572 List (Attribute msg)
@@ -2089,7 +2105,11 @@ onKeyLookup lookup =
20892105 Json.field "key" Json.string
20902106 |> Json.andThen decode
20912107 in
2092− Internal.Attr <| Html.Events.on "keyup" isKey
2108+ -- We generally want these attached to the keydown event becaues it allows us to prevent default on things like spacebar scrolling the page.
2109+ -- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role
2110+ Internal.Attr <|
2111+ Html.Events.preventDefaultOn "keydown"
2112+ (Json.map (\fired -> ( fired, True )) isKey)
20932113
20942114
20952115{-| -}
@@ -2185,7 +2205,8 @@ defaultCheckbox : Bool -> Element msg
21852205defaultCheckbox checked =
21862206 Element.el
21872207 [ Internal.htmlClass "focusable"
2188− , Element.width (Element.px 14)
2208+ , Element.width
2209+ (Element.px 14)
21892210 , Element.height (Element.px 14)
21902211 , Font.color white
21912212 , Element.centerY
@@ -2221,9 +2242,8 @@ defaultCheckbox checked =
22212242
22222243 else
22232244 1
2224− ]
2225− (if checked then
2226− Element.el
2245+ , Element.inFront
2246+ (Element.el
22272247 [ Border.color white
22282248 , Element.height (Element.px 6)
22292249 , Element.width (Element.px 9)
@@ -2231,6 +2251,7 @@ defaultCheckbox checked =
22312251 , Element.centerX
22322252 , Element.centerY
22332253 , Element.moveUp 1
2254+ , Element.transparent (not checked)
22342255 , Border.widthEach
22352256 { top = 0
22362257 , left = 2
@@ -2239,7 +2260,6 @@ defaultCheckbox checked =
22392260 }
22402261 ]
22412262 Element.none
2242−
2243− else
2244− Element.none
2245− )
2263+ )
2264+ ]
2265+ Element.none