diff --git a/CHANGELOG.md b/CHANGELOG.md index 963cd84ef0..ad4f1556a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ - cancel old message highlight animations when a new message is highlighted #4203 - fix: packaging: include architecture in filename for all appimages #4202 - fix: make open external link scheme case insensive #4201 +- improve accessibility a little #4133, #4210 diff --git a/_locales/_untranslated_en.json b/_locales/_untranslated_en.json index 904559e5de..b05f12f08c 100644 --- a/_locales/_untranslated_en.json +++ b/_locales/_untranslated_en.json @@ -74,5 +74,8 @@ }, "join_group": { "message": "Join Group" + }, + "react_more_emojis": { + "message": "More emojis…" } } diff --git a/packages/frontend/scss/chat/_chat-list-item.scss b/packages/frontend/scss/chat/_chat-list-item.scss index ab20edfb05..0ac21f42d7 100644 --- a/packages/frontend/scss/chat/_chat-list-item.scss +++ b/packages/frontend/scss/chat/_chat-list-item.scss @@ -3,6 +3,11 @@ .chat-list-item, .pseudo-chat-list-item { height: 64px; + width: 100%; + text-align: unset; + color: var(--globalText); + background-color: transparent; + border: none; display: flex; flex-direction: row; padding: 0px 10px; diff --git a/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx b/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx index e812f11c9e..611deb730d 100644 --- a/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx +++ b/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx @@ -133,7 +133,7 @@ export default function AccountItem({ badgeContent = (
@@ -150,7 +150,7 @@ export default function AccountItem({ ) } - const ref = useRef(null) + const ref = useRef(null) useLayoutEffect(() => { if (!isSelected) { return @@ -186,7 +186,7 @@ export default function AccountItem({ }, [isSelected, window.__screen]) return ( -
)}
{badgeContent}
-
+ ) } diff --git a/packages/frontend/src/components/AccountListSidebar/AccountListSidebar.tsx b/packages/frontend/src/components/AccountListSidebar/AccountListSidebar.tsx index 503c81c6e0..ad316364fe 100644 --- a/packages/frontend/src/components/AccountListSidebar/AccountListSidebar.tsx +++ b/packages/frontend/src/components/AccountListSidebar/AccountListSidebar.tsx @@ -24,6 +24,7 @@ import { ScreenContext } from '../../contexts/ScreenContext' import useChat from '../../hooks/chat/useChat' import { Screens } from '../../ScreenController' import { ActionEmitter, KeybindAction } from '../../keybindings' +import useTranslationFunction from '../../hooks/useTranslationFunction' type Props = { onAddAccount: () => Promise @@ -38,6 +39,8 @@ export default function AccountListSidebar({ openAccountDeletionScreen, selectedAccountId, }: Props) { + const tx = useTranslationFunction() + const { openDialog } = useDialog() const [accounts, setAccounts] = useState([]) const [{ accounts: noficationSettings }] = useAccountNotificationStore() @@ -94,7 +97,7 @@ export default function AccountListSidebar({ const updateHoverInfoPosition = useCallback(() => { if (hoverInfo.current && accountForHoverInfo) { const elem = document.querySelector( - `div[x-account-sidebar-account-id="${accountForHoverInfo.id}"]` + `[x-account-sidebar-account-id="${accountForHoverInfo.id}"]` ) if (elem) { const rect = elem.getBoundingClientRect() @@ -138,14 +141,22 @@ export default function AccountListSidebar({ muted={noficationSettings[account.id]?.muted || false} /> ))} - {/* The condition is the same as in https://github.com/deltachat/deltachat-desktop/blob/63af023437ff1828a27de2da37bf94ab180ec528/src/renderer/contexts/KeybindingsContext.tsx#L26 */} {window.__screen === Screens.Main && (
- diff --git a/packages/frontend/src/components/SearchInput/index.tsx b/packages/frontend/src/components/SearchInput/index.tsx index 1823893ab3..22d2201df0 100644 --- a/packages/frontend/src/components/SearchInput/index.tsx +++ b/packages/frontend/src/components/SearchInput/index.tsx @@ -51,6 +51,7 @@ export default function SearchInput(props: Props) { className={classNames(styles.searchInput)} ref={props.inputRef} spellCheck={false} + aria-keyshortcuts='Control+K' /> {hasValue && ( @@ -40,6 +41,8 @@ function ReactButton(props: { messageId: number reactions: T.Message['reactions'] }) { + const tx = useTranslationFunction() + const { showReactionsBar } = useReactionsBar() const onClick = (event: OnButtonClick) => { @@ -60,15 +63,25 @@ function ReactButton(props: { } return ( - ) } function ContextMenuButton(props: { onClick: (event: OnButtonClick) => void }) { + const tx = useTranslationFunction() + return ( - ) diff --git a/packages/frontend/src/components/chat/ChatListItem.tsx b/packages/frontend/src/components/chat/ChatListItem.tsx index acfb3c49a5..28b6c93f9f 100644 --- a/packages/frontend/src/components/chat/ChatListItem.tsx +++ b/packages/frontend/src/components/chat/ChatListItem.tsx @@ -172,8 +172,7 @@ function ChatListItemArchiveLink({ ]) return ( -
{tx('chat_archived_chats_title')}
- + ) } @@ -201,13 +200,14 @@ function ChatListItemError({ kind: 'Error' } onClick: () => void - onContextMenu?: (event: React.MouseEvent) => void + onContextMenu?: ( + event: React.MouseEvent + ) => void isSelected?: boolean }) { log.info('Error Loading Chatlistitem ' + chatListItem.id, chatListItem.error) return ( -
- + ) } @@ -249,14 +249,15 @@ function ChatListItemNormal({ kind: 'ChatListItem' } onClick: () => void - onContextMenu?: (event: React.MouseEvent) => void + onContextMenu?: ( + event: React.MouseEvent + ) => void isContextMenuActive?: boolean isSelected?: boolean hover?: boolean }) { return ( -
- + ) } type ChatListItemProps = { chatListItem: Type.ChatListItemFetchResult | undefined onClick: () => void - onContextMenu?: (event: React.MouseEvent) => void + onContextMenu?: ( + event: React.MouseEvent + ) => void isContextMenuActive?: boolean isSelected?: boolean hover?: boolean @@ -367,8 +370,7 @@ export const ChatListItemMessageResult = React.memo<{ const { msr, onClick, queryStr } = props if (typeof msr === 'undefined') return return ( -
@@ -424,7 +426,7 @@ export const ChatListItemMessageResult = React.memo<{
{rMessage(msr.message, queryStr)}
- + ) }) diff --git a/packages/frontend/src/components/composer/Composer.tsx b/packages/frontend/src/components/composer/Composer.tsx index 9305c5bd61..f12f410338 100644 --- a/packages/frontend/src/components/composer/Composer.tsx +++ b/packages/frontend/src/components/composer/Composer.tsx @@ -5,6 +5,7 @@ import React, { forwardRef, useLayoutEffect, useCallback, + useMemo, } from 'react' import { C, T } from '@deltachat/jsonrpc-client' @@ -38,6 +39,7 @@ import { VisualVCardComponent } from '../message/VCard' import { KeybindAction } from '../../keybindings' import useKeyBindingAction from '../../hooks/useKeyBindingAction' import { CloseButton } from '../Dialog' +import { enterKeySendsKeyboardShortcuts } from '../KeyboardShortcutHint' const log = getLogger('renderer/composer') @@ -263,6 +265,23 @@ const Composer = forwardRef< messageInputRef.current?.focus() }, [chatId, messageInputRef]) + const ariaSendShortcut: string = useMemo(() => { + if (settingsStore == undefined) { + return '' + } + + const firstShortcut = enterKeySendsKeyboardShortcuts( + settingsStore.desktopSettings.enterKeySends + )[0].keyBindings[0] + + if (!Array.isArray(firstShortcut) || !firstShortcut.includes('Enter')) { + log.warn('Unexpected shortcut for "Send Message"') + return '' + } + + return firstShortcut.join('+') + }, [settingsStore]) + if (chatId === null) { return
Error, chatid missing
} @@ -378,7 +397,10 @@ const Composer = forwardRef<
-
{showEmojiPicker && ( diff --git a/packages/frontend/src/components/composer/ComposerMessageInput.tsx b/packages/frontend/src/components/composer/ComposerMessageInput.tsx index dc8640fe75..2a6dae3403 100644 --- a/packages/frontend/src/components/composer/ComposerMessageInput.tsx +++ b/packages/frontend/src/components/composer/ComposerMessageInput.tsx @@ -229,6 +229,7 @@ export default class ComposerMessageInput extends React.Component< disabled={this.state.loadingDraft} dir='auto' spellCheck={true} + aria-keyshortcuts='Control+N' /> ) } diff --git a/packages/frontend/src/components/composer/menuAttachment.tsx b/packages/frontend/src/components/composer/menuAttachment.tsx index 323fb32df9..be809e6752 100644 --- a/packages/frontend/src/components/composer/menuAttachment.tsx +++ b/packages/frontend/src/components/composer/menuAttachment.tsx @@ -177,6 +177,7 @@ export default function MenuAttachment({ return (