diff --git a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/__snapshots__/keyboard_shortcuts_modal.test.tsx.snap b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/__snapshots__/keyboard_shortcuts_modal.test.tsx.snap index 62e9bb586c..f54577fdbf 100644 --- a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/__snapshots__/keyboard_shortcuts_modal.test.tsx.snap +++ b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/__snapshots__/keyboard_shortcuts_modal.test.tsx.snap @@ -65,7 +65,11 @@ exports[`components/KeyboardShortcutsModal should match snapshot modal 1`] = ` +
@@ -708,7 +712,11 @@ exports[`components/KeyboardShortcutsModal should match snapshot modal with Call +
diff --git a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx index 61f3fa60d2..48eae2a0cf 100644 --- a/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx +++ b/webapp/channels/src/components/keyboard_shortcuts/keyboard_shortcuts_modal/keyboard_shortcuts_modal.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // 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 {defineMessages, useIntl} from 'react-intl'; import {useSelector} from 'react-redux'; @@ -84,6 +84,7 @@ interface Props { const KeyboardShortcutsModal = ({onExited}: Props): JSX.Element => { const [show, setShow] = useState(true); + const contentRef = useRef(null); const {formatMessage} = useIntl(); @@ -104,6 +105,10 @@ const KeyboardShortcutsModal = ({onExited}: Props): JSX.Element => { }); }; + useEffect(() => { + contentRef.current?.focus(); + }, []); + return ( { - + +