Skip to content

Commit ca3c99a

Browse files
authored
Merge pull request #2671 from codecrafters-io/CC-1638
Make code-blocks non focusable using tab
2 parents 4161639 + 579ff70 commit ca3c99a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/helpers/markdown-to-html.ts

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ export default class MarkdownToHtml extends Helper<Signature> {
4444
node.setAttribute('target', '_blank');
4545
node.setAttribute('rel', 'noopener noreferrer');
4646
}
47+
48+
// https://github.com/PrismJS/prism/issues/3658
49+
// PrismJS unconditionally adds a tabindex to <pre> elements, without any opt-out
50+
if (node.nodeName === 'PRE') {
51+
node.setAttribute('tabindex', '-1');
52+
}
4753
});
4854

4955
return DOMPurify.sanitize(generatedHtml);

0 commit comments

Comments
 (0)