Skip to content

Commit fba6dda

Browse files
authored
Accessibility fixes for docs (#2861)
1 parent 8408cce commit fba6dda

File tree

8 files changed

+104
-41
lines changed

8 files changed

+104
-41
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* Default color is 888, change to 666 for at least a 4.5 contrast ratio */
2+
li .item { color: #666; cursor: pointer; }
3+
#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #666; padding-left: 0; padding-right: 24px; }
4+
5+
/* Override opacity for at least a 4.5 contrast ratio */
6+
li.collapsed a.toggle {
7+
opacity: 1;
8+
cursor: default;
9+
background-position: top left;
10+
}
11+
12+
/* Make all links underlined */
13+
a { text-decoration: underline !important; }
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<!-- Add language -->
3+
<html lang="en">
4+
<head>
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta charset="<%= charset %>" />
7+
<% stylesheets_full_list.each do |stylesheet| %>
8+
<link rel="stylesheet" href="<%= mtime_url(stylesheet) %>" type="text/css" media="screen" />
9+
<% end %>
10+
11+
<% javascripts_full_list.each do |javascript| %>
12+
<script type="text/javascript" charset="utf-8" src="<%= mtime_url(javascript) %>"></script>
13+
<% end %>
14+
15+
<title><%= @list_title %></title>
16+
<base id="base_target" target="_parent" />
17+
</head>
18+
<body>
19+
<div id="content">
20+
<div class="fixed_header">
21+
<h1 id="full_list_header"><%= @list_title %></h1>
22+
<div id="full_list_nav">
23+
<% menu_lists.each do |list| %>
24+
<span><a target="_self" href="<%= url_for_list list[:type] %>">
25+
<%= list[:title] %>
26+
</a></span>
27+
<% end %>
28+
</div>
29+
30+
<!-- Add label for search -->
31+
<div id="search">
32+
<label for="search-class">Search:</label>
33+
<input id="search-class" type="text">
34+
</div>
35+
</div>
36+
37+
<ul id="full_list" class="<%= @list_class || @list_type %>">
38+
<%= erb "full_list_#{@list_type}" %>
39+
</ul>
40+
</div>
41+
</body>
42+
</html>
43+

doc-src/templates/default/fulldoc/html/full_list_class.erb

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
def class_list(root = Registry.root, tree = TreeContext.new)
2+
out = String.new('')
23
children = run_verifier(root.children)
34
if root == Registry.root
45
children += @items.select {|o| o.namespace.is_a?(CodeObjects::Proxy) }
56
end
67
service_children = Registry.at('Aws').children.select { |c| c.group == 'service' }
78

8-
out = ''
99
# non-service classes
1010
out << "<li class='#{tree.classes.join(' ')} nolink'>"
1111
out << "<div class='item' style='padding-left:#{tree.indent}'>"
12-
out << "<a class='toggle'></a> Non-Service Classes"
12+
out << "Non-Service classes"
1313
out << "</div><ul>"
1414
tree.nest do
1515
out << class_list_children(children, tree, skip_services: true)
@@ -19,7 +19,7 @@ def class_list(root = Registry.root, tree = TreeContext.new)
1919
# service classes
2020
out << "<li class='#{tree.classes.join(' ')} nolink'>"
2121
out << "<div class='item' style='padding-left:#{tree.indent}'>"
22-
out << "<a class='toggle'></a> Service Gems"
22+
out << "Service Classes"
2323
out << "</div><ul>"
2424
tree.nest do
2525
out << class_list_children(service_children, tree)
@@ -32,34 +32,34 @@ def class_list_children(children, tree, options = {})
3232
skip_services = options[:skip_services]
3333
out = String.new("")
3434
children.compact.sort_by(&:path).each do |child|
35-
if child.is_a?(CodeObjects::NamespaceObject)
36-
next if skip_services && child.group == 'service'
37-
name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name
38-
grand_children = run_verifier(child.children)
39-
is_parent = grand_children.any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
40-
out << "<li id='object_#{child.path}' class='#{tree.classes.join(' ')}'>"
41-
out << "<div class='item' style='padding-left:#{tree.indent}'>"
42-
out << "<a class='toggle'></a> " if is_parent
43-
out << linkify(child, name)
44-
out << " &lt; #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass
45-
if child.group == 'service'
46-
if name.downcase == :sts || name.downcase == :sso || name.downcase == :ssooidc
47-
out << " (aws-sdk-core)"
48-
else
49-
out << " (aws-sdk-#{name.downcase})"
50-
end
35+
next unless child.is_a?(CodeObjects::NamespaceObject)
36+
next if skip_services && child.group == 'service'
37+
38+
name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name
39+
grand_children = run_verifier(child.children)
40+
is_parent = grand_children.any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
41+
out << "<li id='object_#{child.path}' class='#{tree.classes.join(' ')}'>"
42+
out << "<div class='item' style='padding-left:#{tree.indent}'>"
43+
out << "<a class='toggle'></a> " if is_parent
44+
out << linkify(child, name)
45+
out << " &lt; #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass
46+
if child.group == 'service'
47+
if name.downcase == :sts || name.downcase == :sso || name.downcase == :ssooidc
48+
out << " (aws-sdk-core)"
49+
else
50+
out << " (aws-sdk-#{name.downcase})"
5151
end
52-
out << "<small class='search_info'>"
53-
out << child.namespace.title
54-
out << "</small>"
55-
out << "</div>"
56-
if is_parent
57-
tree.nest do
58-
out << "<ul>#{class_list_children(grand_children, tree, options)}</ul>"
59-
end
52+
end
53+
out << "<small class='search_info'>"
54+
out << child.namespace.title
55+
out << "</small>"
56+
out << "</div>"
57+
if is_parent
58+
tree.nest do
59+
out << "<ul>#{class_list_children(grand_children, tree, options)}</ul>"
6060
end
61-
out << "</li>"
6261
end
62+
out << "</li>"
6363
end
6464
out
6565
end

doc-src/templates/default/layout/html/layout.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html>
2+
<html lang="en">
33
<head>
44
<%= erb(:headers) %>
55
<!-- Docs Metrics + Cookie Consent Script -->
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<% if object.has_tag?(:example) %>
2+
<div class="examples">
3+
<h4 class="tag_title">Examples:</h4>
4+
<% object.tags(:example).each do |tag| %>
5+
<% unless tag.name.empty? %>
6+
<h5 class="example_title"><%= htmlify_line(tag.name) %></h5>
7+
<% end %>
8+
<pre class="example code"><code><%= html_syntax_highlight(tag.text) %></code></pre>
9+
<% end %>
10+
</div>
11+
<% end %>

gems/aws-sdk-core/lib/aws-defaults/default_configuration.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Aws
2020
# * Globally via the "AWS_DEFAULTS_MODE" environment variable.
2121
#
2222
#
23-
# @code_generation START - documentation
23+
# #defaults START - documentation
2424
# The following `:default_mode` values are supported:
2525
#
2626
# * `'standard'` -
@@ -105,10 +105,10 @@ module Aws
105105
# [2]: https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-retry_mode.html
106106
# [3]: https://docs.aws.amazon.com/sdkref/latest/guide/setting-global-sts_regional_endpoints.html
107107
#
108-
# @code_generation END - documentation
108+
# #defaults END - documentation
109109
module DefaultsModeConfiguration
110110
# @api private
111-
# @code_generation START - configuration
111+
# #defaults START - configuration
112112
SDK_DEFAULT_CONFIGURATION =
113113
{
114114
"version" => 1,
@@ -148,6 +148,6 @@ module DefaultsModeConfiguration
148148
}
149149
}
150150
}
151-
# @code_generation END - configuration
151+
# #defaults END - configuration
152152
end
153153
end

tasks/update-defaults-mode.rake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ task 'update-defaults-mode', [:defaults_file] do |t, args|
3939
puts "Updating DefaultsModeConfiguration documentation"
4040
BuildTools.replace_lines(
4141
filename: "#{$GEMS_DIR}/aws-sdk-core/lib/aws-defaults/default_configuration.rb",
42-
start: /# @code_generation START - documentation/,
43-
stop: /# @code_generation END - documentation/,
42+
start: /# #defaults START - documentation/,
43+
stop: /# #defaults END - documentation/,
4444
new_lines: [docs, "\n"]
4545
)
4646

@@ -56,8 +56,8 @@ task 'update-defaults-mode', [:defaults_file] do |t, args|
5656
puts "Updating DefaultsModeConfiguration configuration constant"
5757
BuildTools.replace_lines(
5858
filename: "#{$GEMS_DIR}/aws-sdk-core/lib/aws-defaults/default_configuration.rb",
59-
start: /# @code_generation START - configuration/,
60-
stop: /# @code_generation END - configuration/,
59+
start: /# #defaults START - configuration/,
60+
stop: /# #defaults END - configuration/,
6161
new_lines: config_constant
6262
)
6363

0 commit comments

Comments
 (0)