fix: add some aria labels and match QA test

pull/2410/head
Audric Ackermann 3 years ago
parent 997cedc42b
commit c54a438f7c

@ -152,6 +152,10 @@
"noNameOrMessage": "No name or content", "noNameOrMessage": "No name or content",
"nameOnly": "Name Only", "nameOnly": "Name Only",
"newMessage": "New Message", "newMessage": "New Message",
"createConversationNewContact": "Create a conversation with a new contact",
"createConversationNewGroup": "Create a group with existing contacts",
"joinACommunity": "Join a community",
"chooseAnAction": "Choose an action to start a conversation",
"newMessages": "New Messages", "newMessages": "New Messages",
"notificationMostRecentFrom": "Most recent from: $name$", "notificationMostRecentFrom": "Most recent from: $name$",
"notificationFrom": "From:", "notificationFrom": "From:",
@ -283,7 +287,7 @@
"changePasswordToastDescription": "Your password has been changed. Please keep it safe.", "changePasswordToastDescription": "Your password has been changed. Please keep it safe.",
"removePasswordToastDescription": "You have removed your password.", "removePasswordToastDescription": "You have removed your password.",
"publicChatExists": "You are already connected to this community", "publicChatExists": "You are already connected to this community",
"connectToServerFail": "Couldn't join group", "connectToServerFail": "Couldn't join community",
"connectingToServer": "Connecting...", "connectingToServer": "Connecting...",
"connectToServerSuccess": "Successfully connected to community", "connectToServerSuccess": "Successfully connected to community",
"setPasswordFail": "Failed to set password", "setPasswordFail": "Failed to set password",

@ -96,7 +96,7 @@ textarea {
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
&.disabled { &.disabled {
cursor: default; cursor: not-allowed;
} }
&.default, &.default,

@ -18,7 +18,7 @@ const AvatarItem = (props: { memberPubkey: string; isAdmin: boolean }) => {
); );
}; };
const StyledSessionMemberItem = styled.div<{ const StyledSessionMemberItem = styled.button<{
inMentions?: boolean; inMentions?: boolean;
zombie?: boolean; zombie?: boolean;
selected?: boolean; selected?: boolean;
@ -29,6 +29,9 @@ const StyledSessionMemberItem = styled.div<{
padding: 0px var(--margins-sm); padding: 0px var(--margins-sm);
height: ${props => (props.inMentions ? '40px' : '50px')}; height: ${props => (props.inMentions ? '40px' : '50px')};
display: flex; display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
transition: var(--default-duration); transition: var(--default-duration);
@ -99,7 +102,6 @@ export const MemberListItem = (props: {
} }
: {} : {}
} }
role="button"
data-testid={dataTestId} data-testid={dataTestId}
zombie={isZombie} zombie={isZombie}
inMentions={inMentions} inMentions={inMentions}

@ -6,7 +6,7 @@ import { getOverlayMode } from '../../state/selectors/section';
import { SessionIcon } from '../icon'; import { SessionIcon } from '../icon';
// tslint:disable: use-simple-attributes // tslint:disable: use-simple-attributes
const StyledMenuButton = styled.label` const StyledMenuButton = styled.button`
position: relative; position: relative;
display: inline-block; display: inline-block;
@ -25,12 +25,6 @@ const StyledMenuButton = styled.label`
} }
`; `;
const StyledMenuInput = styled.input`
opacity: 0;
width: 0;
height: 0;
`;
/** /**
* This is the Session Menu Botton. i.e. the button on top of the conversation list to start a new conversation. * This is the Session Menu Botton. i.e. the button on top of the conversation list to start a new conversation.
* It has two state: selected or not and so we use an checkbox input to keep the state in sync. * It has two state: selected or not and so we use an checkbox input to keep the state in sync.
@ -54,13 +48,14 @@ export const MenuButton = () => {
'--fg-color': 'white', '--fg-color': 'white',
} as CSSProperties } as CSSProperties
} }
onClick={onClickFn}
> >
<StyledMenuInput type="checkbox" checked={isToggled} onClick={onClickFn} />
<SessionIcon <SessionIcon
iconSize="small" iconSize="small"
iconType="plusFat" iconType="plusFat"
iconColor="var(--fg-color)" iconColor="var(--fg-color)"
iconRotation={isToggled ? 45 : 0} iconRotation={isToggled ? 45 : 0}
aria-label={window.i18n('chooseAnAction')}
/> />
</StyledMenuButton> </StyledMenuButton>
); );

@ -17,6 +17,7 @@ import useKey from 'react-use/lib/useKey';
import styled from 'styled-components'; import styled from 'styled-components';
import { SessionSearchInput } from '../../SessionSearchInput'; import { SessionSearchInput } from '../../SessionSearchInput';
import { getSearchResults, isSearching } from '../../../state/selectors/search'; import { getSearchResults, isSearching } from '../../../state/selectors/search';
import { VALIDATION } from '../../../session/constants';
const StyledMemberListNoContacts = styled.div` const StyledMemberListNoContacts = styled.div`
font-family: var(--font-font-mono); font-family: var(--font-font-mono);
@ -101,6 +102,8 @@ export const OverlayClosedGroup = () => {
} }
const contactsToRender = isSearch ? sharedWithResults : privateContactsPubkeys; const contactsToRender = isSearch ? sharedWithResults : privateContactsPubkeys;
const disableCreateButton = !selectedMemberIds.length && !groupName.length;
return ( return (
<div className="module-left-pane-overlay"> <div className="module-left-pane-overlay">
<OverlayHeader title={title} subtitle={subtitle} /> <OverlayHeader title={title} subtitle={subtitle} />
@ -110,7 +113,7 @@ export const OverlayClosedGroup = () => {
placeholder={placeholder} placeholder={placeholder}
value={groupName} value={groupName}
isGroup={true} isGroup={true}
maxLength={100} maxLength={VALIDATION.MAX_GROUP_NAME_LENGTH}
onChange={setGroupName} onChange={setGroupName}
onPressEnter={onEnterPressed} onPressEnter={onEnterPressed}
dataTestId="new-closed-group-name" dataTestId="new-closed-group-name"
@ -150,7 +153,7 @@ export const OverlayClosedGroup = () => {
buttonColor={SessionButtonColor.Green} buttonColor={SessionButtonColor.Green}
buttonType={SessionButtonType.BrandOutline} buttonType={SessionButtonType.BrandOutline}
text={buttonText} text={buttonText}
disabled={noContactsForClosedGroup} disabled={disableCreateButton}
onClick={onEnterPressed} onClick={onEnterPressed}
dataTestId="next-button" dataTestId="next-button"
margin="auto 0 var(--margins-lg) 0 " // just to keep that button at the bottom of the overlay (even with an empty list) margin="auto 0 var(--margins-lg) 0 " // just to keep that button at the bottom of the overlay (even with an empty list)

@ -78,14 +78,13 @@ export const OverlayCommunity = () => {
<SessionSpinner loading={loading} /> <SessionSpinner loading={loading} />
<SessionJoinableRooms onRoomClicked={closeOverlay} /> <SessionJoinableRooms onRoomClicked={closeOverlay} />
{groupUrl && ( <SessionButton
<SessionButton buttonColor={SessionButtonColor.Green}
buttonColor={SessionButtonColor.Green} buttonType={SessionButtonType.BrandOutline}
buttonType={SessionButtonType.BrandOutline} text={buttonText}
text={buttonText} disabled={!groupUrl}
onClick={onEnterPressed} onClick={onEnterPressed}
/> />
)}
</div> </div>
); );
}; };

@ -45,6 +45,8 @@ export const OverlayMessage = () => {
const subtitle = window.i18n('enterSessionIDOrONSName'); const subtitle = window.i18n('enterSessionIDOrONSName');
const placeholder = window.i18n('enterSessionIDOfRecipient'); const placeholder = window.i18n('enterSessionIDOfRecipient');
const disableNextButton = !pubkeyOrOns || loading;
async function openConvoOnceResolved(resolvedSessionID: string) { async function openConvoOnceResolved(resolvedSessionID: string) {
const convo = await getConversationController().getOrCreateAndWait( const convo = await getConversationController().getOrCreateAndWait(
resolvedSessionID, resolvedSessionID,
@ -105,6 +107,7 @@ export const OverlayMessage = () => {
placeholder={placeholder} placeholder={placeholder}
onChange={setPubkeyOrOns} onChange={setPubkeyOrOns}
dataTestId="new-session-conversation" dataTestId="new-session-conversation"
onPressEnter={handleMessageButtonClick}
/> />
<SessionSpinner loading={loading} /> <SessionSpinner loading={loading} />
@ -128,7 +131,7 @@ export const OverlayMessage = () => {
buttonColor={SessionButtonColor.Green} buttonColor={SessionButtonColor.Green}
buttonType={SessionButtonType.BrandOutline} buttonType={SessionButtonType.BrandOutline}
text={buttonText} text={buttonText}
disabled={false} disabled={disableNextButton}
onClick={handleMessageButtonClick} onClick={handleMessageButtonClick}
dataTestId="next-new-conversation-button" dataTestId="next-new-conversation-button"
/> />

@ -41,7 +41,7 @@ const StyledContactRowName = styled.div`
font-size: var(--font-size-lg); font-size: var(--font-size-lg);
`; `;
const StyledRowContainer = styled.div` const StyledRowContainer = styled.button`
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 var(--margins-lg); padding: 0 var(--margins-lg);

@ -66,15 +66,27 @@ export const OverlayChooseAction = () => {
return ( return (
<div className="module-left-pane-overlay"> <div className="module-left-pane-overlay">
<StyledActionRow onClick={openNewMessage} data-testid="chooser-new-conversation-button"> <StyledActionRow
onClick={openNewMessage}
data-testid="chooser-new-conversation-button"
aria-label={window.i18n('createConversationNewContact')}
>
<IconOnActionRow iconType="chatBubble" /> <IconOnActionRow iconType="chatBubble" />
<StyledChooseActionTitle>{window.i18n('newMessage')}</StyledChooseActionTitle> <StyledChooseActionTitle>{window.i18n('newMessage')}</StyledChooseActionTitle>
</StyledActionRow> </StyledActionRow>
<StyledActionRow onClick={openCreateGroup} data-testid="chooser-new-group"> <StyledActionRow
onClick={openCreateGroup}
data-testid="chooser-new-group"
aria-label={window.i18n('createConversationNewGroup')}
>
<IconOnActionRow iconType="group" /> <IconOnActionRow iconType="group" />
<StyledChooseActionTitle>{window.i18n('createGroup')}</StyledChooseActionTitle> <StyledChooseActionTitle>{window.i18n('createGroup')}</StyledChooseActionTitle>
</StyledActionRow> </StyledActionRow>
<StyledActionRow onClick={openJoinCommunity} data-testid="chooser-new-community"> <StyledActionRow
onClick={openJoinCommunity}
data-testid="chooser-new-community"
aria-label={window.i18n('joinACommunity')}
>
<IconOnActionRow iconType="communities" /> <IconOnActionRow iconType="communities" />
<StyledChooseActionTitle>{window.i18n('joinOpenGroup')}</StyledChooseActionTitle> <StyledChooseActionTitle>{window.i18n('joinOpenGroup')}</StyledChooseActionTitle>
</StyledActionRow> </StyledActionRow>

@ -45,7 +45,7 @@ export const CONVERSATION = {
export const MAX_ATTACHMENT_FILESIZE_BYTES = 6 * 1000 * 1000; // 6MB export const MAX_ATTACHMENT_FILESIZE_BYTES = 6 * 1000 * 1000; // 6MB
export const VALIDATION = { export const VALIDATION = {
MAX_GROUP_NAME_LENGTH: 64, MAX_GROUP_NAME_LENGTH: 30,
CLOSED_GROUP_SIZE_LIMIT: 100, CLOSED_GROUP_SIZE_LIMIT: 100,
}; };

@ -62,12 +62,14 @@ export type LocalizerKeys =
| 'timerOption_1_hour' | 'timerOption_1_hour'
| 'youGotKickedFromGroup' | 'youGotKickedFromGroup'
| 'cannotRemoveCreatorFromGroupDesc' | 'cannotRemoveCreatorFromGroupDesc'
| 'contactAvatarAlt'
| 'incomingError' | 'incomingError'
| 'notificationsSettingsTitle' | 'notificationsSettingsTitle'
| 'ringing' | 'ringing'
| 'tookAScreenshot' | 'tookAScreenshot'
| 'from' | 'from'
| 'thisMonth' | 'thisMonth'
| 'chooseAnAction'
| 'next' | 'next'
| 'addModerators' | 'addModerators'
| 'sessionMessenger' | 'sessionMessenger'
@ -79,6 +81,7 @@ export type LocalizerKeys =
| 'openMessageRequestInbox' | 'openMessageRequestInbox'
| 'enterPassword' | 'enterPassword'
| 'enterSessionIDOfRecipient' | 'enterSessionIDOfRecipient'
| 'join'
| 'dialogClearAllDataDeletionFailedMultiple' | 'dialogClearAllDataDeletionFailedMultiple'
| 'clearAllReactions' | 'clearAllReactions'
| 'pinConversationLimitToastDescription' | 'pinConversationLimitToastDescription'
@ -166,6 +169,7 @@ export type LocalizerKeys =
| 'copyOpenGroupURL' | 'copyOpenGroupURL'
| 'setPasswordInvalid' | 'setPasswordInvalid'
| 'timerOption_30_seconds_abbreviated' | 'timerOption_30_seconds_abbreviated'
| 'createConversationNewContact'
| 'removeResidueMembers' | 'removeResidueMembers'
| 'areYouSureDeleteEntireAccount' | 'areYouSureDeleteEntireAccount'
| 'noGivenPassword' | 'noGivenPassword'
@ -194,6 +198,7 @@ export type LocalizerKeys =
| 'incomingCallFrom' | 'incomingCallFrom'
| 'timerSetOnSync' | 'timerSetOnSync'
| 'deleteMessages' | 'deleteMessages'
| 'searchForContactsOnly'
| 'spellCheckTitle' | 'spellCheckTitle'
| 'translation' | 'translation'
| 'editMenuSelectAll' | 'editMenuSelectAll'
@ -236,7 +241,6 @@ export type LocalizerKeys =
| 'invalidSessionId' | 'invalidSessionId'
| 'audioPermissionNeeded' | 'audioPermissionNeeded'
| 'createGroup' | 'createGroup'
| 'create'
| 'add' | 'add'
| 'messageRequests' | 'messageRequests'
| 'show' | 'show'
@ -255,6 +259,7 @@ export type LocalizerKeys =
| 'hideMenuBarTitle' | 'hideMenuBarTitle'
| 'imageCaptionIconAlt' | 'imageCaptionIconAlt'
| 'sendRecoveryPhraseTitle' | 'sendRecoveryPhraseTitle'
| 'joinACommunity'
| 'multipleJoinedTheGroup' | 'multipleJoinedTheGroup'
| 'messageRequestAcceptedOursNoName' | 'messageRequestAcceptedOursNoName'
| 'databaseError' | 'databaseError'
@ -291,6 +296,7 @@ export type LocalizerKeys =
| 'cancel' | 'cancel'
| 'decline' | 'decline'
| 'originalMessageNotFound' | 'originalMessageNotFound'
| 'create'
| 'autoUpdateRestartButtonLabel' | 'autoUpdateRestartButtonLabel'
| 'deleteConversationConfirmation' | 'deleteConversationConfirmation'
| 'timerOption_6_hours_abbreviated' | 'timerOption_6_hours_abbreviated'
@ -313,7 +319,7 @@ export type LocalizerKeys =
| 'error' | 'error'
| 'clearAllData' | 'clearAllData'
| 'pruningOpengroupDialogTitle' | 'pruningOpengroupDialogTitle'
| 'contactAvatarAlt' | 'createConversationNewGroup'
| 'disappearingMessages' | 'disappearingMessages'
| 'autoUpdateNewVersionTitle' | 'autoUpdateNewVersionTitle'
| 'linkPreviewDescription' | 'linkPreviewDescription'
@ -371,7 +377,6 @@ export type LocalizerKeys =
| 'audioMessageAutoplayTitle' | 'audioMessageAutoplayTitle'
| 'removePasswordInvalid' | 'removePasswordInvalid'
| 'password' | 'password'
| 'usersCanShareTheir...'
| 'nicknamePlaceholder' | 'nicknamePlaceholder'
| 'linkPreviewsTitle' | 'linkPreviewsTitle'
| 'continue' | 'continue'
@ -399,7 +404,6 @@ export type LocalizerKeys =
| 'closedGroupMaxSize' | 'closedGroupMaxSize'
| 'messagesHeader' | 'messagesHeader'
| 'joinOpenGroup' | 'joinOpenGroup'
| 'join'
| 'callMediaPermissionsDialogContent' | 'callMediaPermissionsDialogContent'
| 'timerOption_1_day_abbreviated' | 'timerOption_1_day_abbreviated'
| 'about' | 'about'
@ -457,7 +461,6 @@ export type LocalizerKeys =
| 'trustThisContactDialogDescription' | 'trustThisContactDialogDescription'
| 'unknownCountry' | 'unknownCountry'
| 'searchFor...' | 'searchFor...'
| 'searchForContactsOnly'
| 'joinedTheGroup' | 'joinedTheGroup'
| 'editGroupName' | 'editGroupName'
| 'reportIssue'; | 'reportIssue';

Loading…
Cancel
Save