remove a couple more invalid aria attributes

This commit is contained in:
Brian Hicks 2019-11-15 17:08:04 -06:00
parent 3e313ac4d3
commit 03eee1aeda
2 changed files with 15 additions and 6 deletions

View File

@ -12,7 +12,7 @@ jq -r -f script/axe-report.jq "$JSON_FILE"
# Hey there! Did this script tell you to check out this file because the
# expected error count went down? Well done! Just change this number to the new
# value.
TARGET_ERRORS=39
TARGET_ERRORS=36
# ideally we'd fail on any failures, but we have had a bunch build up over time!
# So right now, we need to fail if the error count is not exactly what we

View File

@ -56,6 +56,7 @@ import Css.Global as Global
import EventExtras.Styled as EventExtras
import Html.Styled.Attributes as Attributes exposing (css)
import Html.Styled.Events as Events
import Json.Encode as Encode
import Nri.Ui
import Nri.Ui.Colors.V1 as Colors
import Nri.Ui.Fonts.V1 as Fonts
@ -305,12 +306,20 @@ viewTooltip_ purpose { trigger, triggerHtml, onTrigger, isOpen, id, extraButtonA
tooltipContainerStyles
[]
[ Html.button
([ case purpose of
PrimaryLabel ->
Aria.labeledBy id
([ if isOpen then
case purpose of
PrimaryLabel ->
Aria.labeledBy id
AuxillaryDescription ->
Aria.describedBy [ id ]
AuxillaryDescription ->
Aria.describedBy [ id ]
else
-- when our tooltips are closed, they're not rendered in the
-- DOM. This means that the ID references above would be
-- invalid and jumping to a reference would not work, so we
-- skip labels and descriptions if the tooltip is closed.
Attributes.property "data-closed-tooltip" Encode.null
, css buttonStyleOverrides
]
++ eventsForTrigger trigger onTrigger