bbc-a11y 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1a5f15fb23bfa023b502767ac8667ef7b3f27ce
|
4
|
+
data.tar.gz: 48b3be883a67e39d68fd2c383c38b5e49af2d444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f936fb98eef71751d1730c3b7736352b38e4822a75dc8b97a1efadfc81b63caf1d352b8c41697a1a8d4b3492f2e319a99ccc30520de3e9d498edb1c05700c85
|
7
|
+
data.tar.gz: f6452c73fd7f27d46a390be8d6054ffda5bc21af07b540c49fa60038a51d0491f459dc168b2e21f48dbc0847590fc040be5e647a7e03e71e1ff75246a26780cb
|
@@ -7,9 +7,15 @@ Feature: Correctly use `tabindex` attributes
|
|
7
7
|
Rationale
|
8
8
|
=========
|
9
9
|
|
10
|
-
Typical BBC pages are made up of several shared components (Global navigation, page content, share tools,
|
11
|
-
|
12
|
-
|
10
|
+
Typical BBC pages are made up of several shared components (Global navigation, page content, share tools,
|
11
|
+
location service widgets, etc.) so no one piece of code has complete awareness of the content of the page
|
12
|
+
or when the content updates. Positive `tabindex` values results in unpredictable tab order that do not occur
|
13
|
+
if the natural order of content is relied upon.
|
14
|
+
|
15
|
+
Using `tabindex="0"` on an element adds it to the document tab order, however it does not change the element
|
16
|
+
type to allow it to be discovered by navigating by link or form element, nor does it bind click and key press
|
17
|
+
handlers to the element. There are no circumstances in which it is not better to use a natively focusable
|
18
|
+
control such as a `<a>` or `<button>`.
|
13
19
|
|
14
20
|
Techniques
|
15
21
|
==========
|
@@ -46,12 +46,14 @@ module BBC
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def heading_elements
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
all_heading_elements = page.all('h1,h2,h3,h4', visible: false)
|
50
|
+
heading_elements_after_first_h1 = []
|
51
|
+
all_heading_elements.each do |node|
|
52
|
+
if node.tag_name == "h1" || heading_elements_after_first_h1.any?
|
53
|
+
heading_elements_after_first_h1 << node
|
54
|
+
end
|
55
|
+
end
|
56
|
+
heading_elements_after_first_h1
|
55
57
|
end
|
56
58
|
|
57
59
|
attr_reader :page
|
data/lib/bbc/a11y/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
@@ -119,5 +119,44 @@ TEXT
|
|
119
119
|
|
120
120
|
end
|
121
121
|
|
122
|
+
context "headings within a script tag" do
|
123
|
+
# e.g. template elements too
|
124
|
+
let(:html) { <<-HTML }
|
125
|
+
<html>
|
126
|
+
<body>
|
127
|
+
<h1>Heading 1</h1>
|
128
|
+
<script>
|
129
|
+
var stuff = "<h2>Heading 2</h2>";
|
130
|
+
</script>
|
131
|
+
</body>
|
132
|
+
</html>
|
133
|
+
HTML
|
134
|
+
|
135
|
+
it "ignores them" do
|
136
|
+
expect( hierarchy.to_s ).to eq "h1"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "with headings before the first h1" do
|
141
|
+
# rules only apply to headings after the main h1
|
142
|
+
let(:html) { <<-HTML }
|
143
|
+
<html>
|
144
|
+
<body>
|
145
|
+
<h3>Ignore me</h3>
|
146
|
+
<h1>Heading 1</h1>
|
147
|
+
<h2>Heading 2</h2>
|
148
|
+
</body>
|
149
|
+
</html>
|
150
|
+
HTML
|
151
|
+
|
152
|
+
it "ignores them" do
|
153
|
+
expected = <<-TEXT
|
154
|
+
h1
|
155
|
+
h2
|
156
|
+
TEXT
|
157
|
+
expect( hierarchy.to_s ).to eq expected.strip
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
122
161
|
end
|
123
162
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbc-a11y
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wynne
|
@@ -244,7 +244,7 @@ rubyforge_project:
|
|
244
244
|
rubygems_version: 2.0.14
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
|
-
summary: bbc-a11y-0.0.
|
247
|
+
summary: bbc-a11y-0.0.9
|
248
248
|
test_files:
|
249
249
|
- features/01_core-purpose.md
|
250
250
|
- features/02_validation.feature
|