Use title to attach info

This commit is contained in:
Tessa Kelly 2022-07-08 17:12:24 -07:00
parent d4b9aeb505
commit ca6328f562
2 changed files with 12 additions and 6 deletions

View File

@ -15,6 +15,7 @@ module Nri.Ui.Svg.V1 exposing
import Accessibility.Styled.Aria as Aria import Accessibility.Styled.Aria as Aria
import Accessibility.Styled.Role as Role import Accessibility.Styled.Role as Role
import Css exposing (Color) import Css exposing (Color)
import Html.Styled.Attributes
import Nri.Ui.Colors.Extra exposing (toCssString) import Nri.Ui.Colors.Extra exposing (toCssString)
import Svg.Styled import Svg.Styled
import Svg.Styled.Attributes exposing (..) import Svg.Styled.Attributes exposing (..)
@ -120,12 +121,17 @@ toHtml (Svg record) =
Maybe.map Aria.label record.label Maybe.map Aria.label record.label
|> Maybe.withDefault (Aria.hidden True) |> Maybe.withDefault (Aria.hidden True)
|> Just |> Just
, -- TODO: double check property , Just Role.img
Just Role.img , Just (Html.Styled.Attributes.attribute "focusable" "false")
-- TODO: make sure svg is not focusable
] ]
++ record.attributes ++ record.attributes
) )
record.icon (case record.label of
Just label ->
Svg.Styled.title [] [ Svg.Styled.text label ]
:: record.icon
Nothing ->
record.icon
)
|> Svg.Styled.map never |> Svg.Styled.map never

View File

@ -78,7 +78,7 @@ viewSettings state =
[] []
] ]
, Html.label [] , Html.label []
[ Html.text "Aria-label: " [ Html.text "Title: "
, Html.input , Html.input
[ Attributes.value state.label [ Attributes.value state.label
, Events.onInput SetLabel , Events.onInput SetLabel