Skip to content

Commit

Permalink
Removes 'tabindex="0"' from `<pre>' elements
Browse files Browse the repository at this point in the history
  • Loading branch information
itamarhaber authored and alecthomas committed Jan 19, 2023
1 parent 3d1bc51 commit 633f8e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions formatters/html/html.go
Expand Up @@ -171,10 +171,10 @@ var (
defaultPreWrapper = preWrapper{
start: func(code bool, styleAttr string) string {
if code {
return fmt.Sprintf(`<pre tabindex="0"%s><code>`, styleAttr)
return fmt.Sprintf(`<pre%s><code>`, styleAttr)
}

return fmt.Sprintf(`<pre tabindex="0"%s>`, styleAttr)
return fmt.Sprintf(`<pre%s>`, styleAttr)
},
end: func(code bool) string {
if code {
Expand Down
4 changes: 2 additions & 2 deletions formatters/html/html_test.go
Expand Up @@ -293,7 +293,7 @@ func TestWithPreWrapper(t *testing.T) {

t.Run("Regular", func(t *testing.T) {
s := format(New(WithClasses(true)))
assert.Equal(t, s, `<pre tabindex="0" class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`)
assert.Equal(t, s, `<pre class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`)
})

t.Run("PreventSurroundingPre", func(t *testing.T) {
Expand Down Expand Up @@ -347,7 +347,7 @@ func TestReconfigureOptions(t *testing.T) {
err = f.Format(&buf, styles.Fallback, it)

assert.NoError(t, err)
assert.Equal(t, `<pre tabindex="0" class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`, buf.String())
assert.Equal(t, `<pre class="chroma"><code><span class="line"><span class="cl"><span class="nb">echo</span> FOO</span></span></code></pre>`, buf.String())
}

func TestWriteCssWithAllClasses(t *testing.T) {
Expand Down

0 comments on commit 633f8e0

Please sign in to comment.