Skip to content

Commit 57c9b4e

Browse files
committed
Move action links out from heading tags
Avoids action link text being read out as part of "navigated to..." announcements. #1987
1 parent 1f1a8a7 commit 57c9b4e

File tree

5 files changed

+59
-37
lines changed

5 files changed

+59
-37
lines changed

assets/css/content/functions.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
}
1717

1818
.content-inner .detail-header {
19-
margin: 2 0 1em;
20-
padding: 0.5em 1em;
19+
margin: 1em 0;
20+
padding: 0.5em 0.85em 0.5em 1em;
2121
background-color: var(--textDetailBackground);
2222
border-left: 3px solid var(--textDetailAccent);
2323
font-size: 1em;

assets/css/content/general.css

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
.content-inner .heading-with-actions {
2+
display: flex;
3+
justify-content: space-between;
4+
align-items: start;
5+
gap: 6px;
6+
}
7+
.content-inner .top-heading {
8+
padding-top: 1rem;
9+
}
10+
.content-inner .heading-with-actions h1 {
11+
flex-grow: 1;
12+
margin: 0;
13+
}
14+
.content-inner .heading-with-actions .icon-action {
15+
flex-grow: 0;
16+
width: 20px;
17+
height: 20px;
18+
display: flex;
19+
justify-content: center;
20+
align-items: center;
21+
font-weight: normal;
22+
}
23+
.content-inner .heading-with-actions.top-heading .icon-action {
24+
padding-top: 1.5rem;
25+
font-size: 1.2rem;
26+
}
27+
128
.content-inner {
229
font-family: var(--defaultFontFamily);
330
font-size: 1em;
@@ -32,11 +59,6 @@
3259
font-weight: 300;
3360
}
3461

35-
.content-inner h1 .icon-action {
36-
font-size: 1.2rem;
37-
font-weight: normal;
38-
}
39-
4062
.content-inner h2 {
4163
font-size: 1.6em;
4264
padding-top: 1em;
@@ -65,17 +87,13 @@
6587
}
6688

6789
.content-inner .icon-action {
68-
float: right;
6990
color: var(--iconAction);
7091
text-decoration: none;
7192
border: none;
7293
transition: color 0.3s ease-in-out;
7394
background-color: transparent;
7495
cursor: pointer;
7596
}
76-
.content-inner button.icon-action {
77-
margin-top: 12px;
78-
}
7997
.content-inner .icon-action:hover {
8098
color: var(--iconActionHover);
8199
}

lib/ex_doc/formatter/html/templates/detail_template.eex

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
<a href="#<%=enc node.id %>" class="detail-link" data-no-tooltip aria-label="Link to this <%= pretty_type(node) %>">
77
<i class="ri-link-m" aria-hidden="true"></i>
88
</a>
9-
<h1 class="signature" translate="no"><%=h node.signature %></h1>
10-
<%= if node.source_url do %>
11-
<a href="<%= node.source_url %>" class="icon-action" rel="help" aria-label="View Source">
12-
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
13-
</a>
14-
<% end %>
15-
<%= for annotation <- node.annotations do %>
16-
<span class="note">(<%= annotation %>)</span>
17-
<% end %>
9+
<div class="heading-with-actions">
10+
<h1 class="signature" translate="no"><%=h node.signature %></h1>
11+
<%= if node.source_url do %>
12+
<a href="<%= node.source_url %>" class="icon-action" rel="help" aria-label="View Source">
13+
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
14+
</a>
15+
<% end %>
16+
<%= for annotation <- node.annotations do %>
17+
<span class="note">(<%= annotation %>)</span>
18+
<% end %>
19+
</div>
1820
</div>
1921
<%= if deprecated = node.deprecated do %>
2022
<div class="deprecated">

lib/ex_doc/formatter/html/templates/extra_template.eex

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22
<%= sidebar_template(config, type, nodes_map) %>
33

44
<div id="top-content">
5-
<h1>
5+
<div class="heading-with-actions top-heading">
6+
<h1><%= node.title_content %></h1>
7+
<%= if type == :cheatmd do %>
8+
<button onclick="window.print()" title="Print Cheatsheet" class="icon-action" rel="print">
9+
<i class="ri-printer-line" aria-hidden="true"></i>
10+
<span class="sr-only">Print Cheatsheet</span>
11+
</button>
12+
<% end %>
613
<%= if node.source_url do %>
714
<a href="<%= node.source_url %>" title="View Source" class="icon-action" rel="help">
815
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
916
<span class="sr-only">View Source</span>
1017
</a>
1118
<% end %>
12-
<%= if type == :cheatmd do %>
13-
<button onclick="window.print()" title="Print Cheatsheet" class="icon-action" rel="print">
14-
<i class="ri-printer-line" aria-hidden="true"></i>
15-
<span class="sr-only">Print cheatsheet</span>
16-
</button>
17-
<% end %>
18-
19-
<span><%= node.title_content %></span>
20-
</h1>
19+
</div>
2120

2221
<%= if type == :livemd do %>
2322
<div class="livebook-badge-container">

lib/ex_doc/formatter/html/templates/module_template.eex

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22
<%= sidebar_template(config, module.type, nodes_map) %>
33

44
<div id="top-content">
5-
<h1>
5+
<div class="heading-with-actions top-heading">
6+
<h1>
7+
<span translate="no"><%= module.title %></span> <%= module_type(module) %>
8+
<small class="app-vsn" translate="no">(<%= config.project %> v<%= config.version %>)</small>
9+
<%= for annotation <- module.annotations do %>
10+
<span class="note">(<%= annotation %>)</span>
11+
<% end %>
12+
</h1>
613
<%= if module.source_url do %>
714
<a href="<%= module.source_url %>" title="View Source" class="icon-action" rel="help">
815
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
916
<span class="sr-only">View Source</span>
1017
</a>
1118
<% end %>
12-
<span translate="no"><%= module.title %></span> <%= module_type(module) %>
13-
<small class="app-vsn" translate="no">(<%= config.project %> v<%= config.version %>)</small>
14-
<%= for annotation <- module.annotations do %>
15-
<span class="note">(<%= annotation %>)</span>
16-
<% end %>
17-
</h1>
19+
</div>
1820

1921
<%= if deprecated = module.deprecated do %>
2022
<div class="deprecated">
@@ -54,4 +56,5 @@
5456
</div>
5557
</section>
5658
<% end %>
59+
5760
<%= footer_template(config, module) %>

0 commit comments

Comments
 (0)