mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-15 09:12:24 +02:00
fix(v2): improve code block scroll accessibility (#2476)
This commit is contained in:
parent
cffb3f9af5
commit
cf884f532d
2 changed files with 6 additions and 0 deletions
|
@ -5,6 +5,8 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
|
||||||
|
|
||||||
import React, {useEffect, useState, useRef} from 'react';
|
import React, {useEffect, useState, useRef} from 'react';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import Highlight, {defaultProps} from 'prism-react-renderer';
|
import Highlight, {defaultProps} from 'prism-react-renderer';
|
||||||
|
@ -117,6 +119,7 @@ export default ({children, className: languageClassName, metastring}) => {
|
||||||
{showCopied ? 'Copied' : 'Copy'}
|
{showCopied ? 'Copied' : 'Copy'}
|
||||||
</button>
|
</button>
|
||||||
<pre
|
<pre
|
||||||
|
tabIndex="0"
|
||||||
className={classnames(className, styles.codeBlock, {
|
className={classnames(className, styles.codeBlock, {
|
||||||
[styles.codeBlockWithTitle]: codeBlockTitle,
|
[styles.codeBlockWithTitle]: codeBlockTitle,
|
||||||
})}>
|
})}>
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
|
||||||
|
|
||||||
import React, {useEffect, useState, useRef} from 'react';
|
import React, {useEffect, useState, useRef} from 'react';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import Highlight, {defaultProps} from 'prism-react-renderer';
|
import Highlight, {defaultProps} from 'prism-react-renderer';
|
||||||
|
@ -136,6 +138,7 @@ export default ({
|
||||||
{showCopied ? 'Copied' : 'Copy'}
|
{showCopied ? 'Copied' : 'Copy'}
|
||||||
</button>
|
</button>
|
||||||
<pre
|
<pre
|
||||||
|
tabIndex="0"
|
||||||
className={classnames(className, styles.codeBlock, {
|
className={classnames(className, styles.codeBlock, {
|
||||||
[styles.codeBlockWithTitle]: codeBlockTitle,
|
[styles.codeBlockWithTitle]: codeBlockTitle,
|
||||||
})}>
|
})}>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue