Skip to content

Commit 9495d7c

Browse files
committed
Except link tag
1 parent a43140b commit 9495d7c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/erblint-github/linters/github/accessibility/no_title_attribute.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class NoTitleAttribute < Linter
1010
include ERBLint::Linters::CustomHelpers
1111
include LinterRegistry
1212

13-
MESSAGE = "The title attribute should never be used unless for an `<iframe>` as it is inaccessible for several groups of users."
13+
MESSAGE = "The title attribute should never be used as it is inaccessible for several groups of users. Exceptions are <iframe> and <link>."
1414

1515
def run(processed_source)
1616
tags(processed_source).each do |tag|
17-
next if tag.name == "iframe"
17+
next if tag.name == "iframe" || tag.name == "link"
1818
next if tag.closing?
1919

2020
title = possible_attribute_values(tag, "title")

test/linters/accessibility/no_title_attribute_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ def test_does_not_warn_if_iframe_sets_title
2222

2323
assert_empty @linter.offenses
2424
end
25+
26+
def test_does_not_warn_if_link_sets_title
27+
@file = "<link rel='unapi-server' type='application/xml' title='unAPI' href='/unapi'/></link>"
28+
@linter.run(processed_source)
29+
30+
assert_empty @linter.offenses
31+
end
2532
end

0 commit comments

Comments
 (0)