Improvements for keyboard navigation in feeds (#35853)
This commit is contained in:
parent
511e10df34
commit
118c30fbc7
17 changed files with 196 additions and 331 deletions
|
|
@ -24,9 +24,7 @@ import { NotificationUpdate } from './notification_update';
|
|||
export const NotificationGroup: React.FC<{
|
||||
notificationGroupId: NotificationGroupModel['group_key'];
|
||||
unread: boolean;
|
||||
onMoveUp: (groupId: string) => void;
|
||||
onMoveDown: (groupId: string) => void;
|
||||
}> = ({ notificationGroupId, unread, onMoveUp, onMoveDown }) => {
|
||||
}> = ({ notificationGroupId, unread }) => {
|
||||
const notificationGroup = useAppSelector((state) =>
|
||||
state.notificationGroups.groups.find(
|
||||
(item) => item.type !== 'gap' && item.group_key === notificationGroupId,
|
||||
|
|
@ -42,14 +40,6 @@ export const NotificationGroup: React.FC<{
|
|||
|
||||
const handlers = useMemo(
|
||||
() => ({
|
||||
moveUp: () => {
|
||||
onMoveUp(notificationGroupId);
|
||||
},
|
||||
|
||||
moveDown: () => {
|
||||
onMoveDown(notificationGroupId);
|
||||
},
|
||||
|
||||
openProfile: () => {
|
||||
if (accountId) dispatch(navigateToProfile(accountId));
|
||||
},
|
||||
|
|
@ -58,7 +48,7 @@ export const NotificationGroup: React.FC<{
|
|||
if (accountId) dispatch(mentionComposeById(accountId));
|
||||
},
|
||||
}),
|
||||
[dispatch, notificationGroupId, accountId, onMoveUp, onMoveDown],
|
||||
[dispatch, accountId],
|
||||
);
|
||||
|
||||
if (!notificationGroup || notificationGroup.type === 'gap') return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue