mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
markup: Add tabindex="0" to default <pre> wrapper
Currently the generated `<pre>` element isn't fully accessible as it can't be focused by keyboard users. To make this fully accessible, the attribute `tabindex="0"` should be added to the `<pre>` tag. Closes #7194
This commit is contained in:
@@ -89,13 +89,13 @@ func TestShortcodeHighlight(t *testing.T) {
|
||||
`{{< highlight java >}}
|
||||
void do();
|
||||
{{< /highlight >}}`,
|
||||
`(?s)<div class="highlight"><pre style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java"`,
|
||||
`(?s)<div class="highlight"><pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java"`,
|
||||
},
|
||||
{
|
||||
`{{< highlight java "style=friendly" >}}
|
||||
void do();
|
||||
{{< /highlight >}}`,
|
||||
`(?s)<div class="highlight"><pre style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java">`,
|
||||
`(?s)<div class="highlight"><pre tabindex="0" style="background-color:#f0f0f0;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java">`,
|
||||
},
|
||||
} {
|
||||
|
||||
|
@@ -1731,12 +1731,12 @@ $$$
|
||||
|
||||
// Blackfriday does not support this extended attribute syntax.
|
||||
b.AssertFileContent("public/page1/index.html",
|
||||
`<pre><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">SHORT</code></pre>`,
|
||||
`<pre><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">MARKDOWN`,
|
||||
`<pre tabindex="0"><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">SHORT</code></pre>`,
|
||||
`<pre tabindex="0"><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">MARKDOWN`,
|
||||
)
|
||||
|
||||
b.AssertFileContent("public/page2/index.html",
|
||||
`<pre><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">SHORT`,
|
||||
`<pre tabindex="0"><code class="language-bash {hl_lines=[1]}" data-lang="bash {hl_lines=[1]}">SHORT`,
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user