resolves #236 - checkboxes need proper markup to be read correctly by screen readers

This commit is contained in:
mdgriffith 2020-07-26 09:01:17 -04:00
parent 2dcbb80369
commit 18fb463b2b

View File

@ -447,22 +447,24 @@ checkbox attrs { label, icon, checked, onChange } =
] ]
++ attrs ++ attrs
in in
applyLabel attributes applyLabel
label (Internal.Attr (Html.Attributes.attribute "role" "checkbox")
(Internal.element :: Internal.Attr
Internal.asEl (Html.Attributes.attribute "aria-checked" <|
Internal.div
[ Internal.Attr <|
Html.Attributes.attribute "role" "checkbox"
, Internal.Attr <|
Html.Attributes.attribute "aria-checked" <|
if checked then if checked then
"true" "true"
else else
"false" "false"
, hiddenLabelAttribute label )
, Element.centerY :: hiddenLabelAttribute label
:: attributes
)
label
(Internal.element
Internal.asEl
Internal.div
[ Element.centerY
, Element.height Element.fill , Element.height Element.fill
, Element.width Element.shrink , Element.width Element.shrink
] ]