MM-55973: Make keyboard shortcuts modal content div accessible via keyboard (#27412)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
06f59531f5
Коммит
13109aeb98
@@ -65,7 +65,11 @@ exports[`components/KeyboardShortcutsModal should match snapshot modal 1`] = `
|
|||||||
<ModalBody
|
<ModalBody
|
||||||
bsClass="modal-body"
|
bsClass="modal-body"
|
||||||
componentClass="div"
|
componentClass="div"
|
||||||
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
tabIndex={-1}
|
||||||
|
/>
|
||||||
<div
|
<div
|
||||||
className="row"
|
className="row"
|
||||||
>
|
>
|
||||||
@@ -708,7 +712,11 @@ exports[`components/KeyboardShortcutsModal should match snapshot modal with Call
|
|||||||
<ModalBody
|
<ModalBody
|
||||||
bsClass="modal-body"
|
bsClass="modal-body"
|
||||||
componentClass="div"
|
componentClass="div"
|
||||||
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
tabIndex={-1}
|
||||||
|
/>
|
||||||
<div
|
<div
|
||||||
className="row"
|
className="row"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import React, {useCallback, useState} from 'react';
|
import React, {useCallback, useEffect, useRef, useState} from 'react';
|
||||||
import {Modal} from 'react-bootstrap';
|
import {Modal} from 'react-bootstrap';
|
||||||
import {defineMessages, useIntl} from 'react-intl';
|
import {defineMessages, useIntl} from 'react-intl';
|
||||||
import {useSelector} from 'react-redux';
|
import {useSelector} from 'react-redux';
|
||||||
@@ -84,6 +84,7 @@ interface Props {
|
|||||||
|
|
||||||
const KeyboardShortcutsModal = ({onExited}: Props): JSX.Element => {
|
const KeyboardShortcutsModal = ({onExited}: Props): JSX.Element => {
|
||||||
const [show, setShow] = useState(true);
|
const [show, setShow] = useState(true);
|
||||||
|
const contentRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const {formatMessage} = useIntl();
|
const {formatMessage} = useIntl();
|
||||||
|
|
||||||
@@ -104,6 +105,10 @@ const KeyboardShortcutsModal = ({onExited}: Props): JSX.Element => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
contentRef.current?.focus();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
dialogClassName='a11y__modal shortcuts-modal'
|
dialogClassName='a11y__modal shortcuts-modal'
|
||||||
@@ -125,7 +130,11 @@ const KeyboardShortcutsModal = ({onExited}: Props): JSX.Element => {
|
|||||||
<strong><KeyboardShortcutSequence shortcut={KEYBOARD_SHORTCUTS.mainHeader}/></strong>
|
<strong><KeyboardShortcutSequence shortcut={KEYBOARD_SHORTCUTS.mainHeader}/></strong>
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body tabIndex={0}>
|
||||||
|
<div
|
||||||
|
tabIndex={-1}
|
||||||
|
ref={contentRef}
|
||||||
|
/>
|
||||||
<div className='row'>
|
<div className='row'>
|
||||||
<div className='col-sm-4'>
|
<div className='col-sm-4'>
|
||||||
<div className='section'>
|
<div className='section'>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user