restore messages tab stop and arrow key navigation

This commit is contained in:
KDSBrowne 2023-07-18 22:55:35 +00:00
parent 5a85ca14a2
commit 19ea189302
2 changed files with 4 additions and 3 deletions

View File

@ -51,7 +51,7 @@ const propTypes = {
const defaultProps = { const defaultProps = {
shortcuts: '', shortcuts: '',
tabIndex: 0, tabIndex: -1,
}; };
const ChatListItem = (props) => { const ChatListItem = (props) => {

View File

@ -47,13 +47,13 @@ class UserMessages extends PureComponent {
this._msgsList.addEventListener( this._msgsList.addEventListener(
'keydown', 'keydown',
this.rove, this.rove,
true,
); );
} }
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
const { selectedChat } = this.state; const { selectedChat } = this.state;
if (selectedChat && selectedChat !== prevState.selectedChat) { if (selectedChat && selectedChat !== prevState.selectedChat) {
const { firstChild } = selectedChat; const { firstChild } = selectedChat;
if (firstChild) firstChild.focus(); if (firstChild) firstChild.focus();
@ -97,6 +97,7 @@ class UserMessages extends PureComponent {
const { selectedChat } = this.state; const { selectedChat } = this.state;
const msgItemsRef = findDOMNode(this._msgItems); const msgItemsRef = findDOMNode(this._msgItems);
roving(event, this.changeState, msgItemsRef, selectedChat); roving(event, this.changeState, msgItemsRef, selectedChat);
event.stopPropagation();
} }
render() { render() {
@ -120,7 +121,7 @@ class UserMessages extends PureComponent {
</Styled.Container> </Styled.Container>
<Styled.ScrollableList <Styled.ScrollableList
role="tabpanel" role="tabpanel"
tabIndex={-1} tabIndex={0}
ref={(ref) => { this._msgsList = ref; }} ref={(ref) => { this._msgsList = ref; }}
> >
<Styled.List> <Styled.List>