Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(a11y): RegisterView #6027

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
27d8790
chore: started to migrate to hooks
OtavioStasiak Nov 27, 2024
6c1b5cc
chore: updated layout
OtavioStasiak Nov 27, 2024
bdf065f
chore: organization of code
OtavioStasiak Nov 27, 2024
0e5b0b6
fix: lint
OtavioStasiak Nov 28, 2024
d892294
chore: updated accessibility button
OtavioStasiak Nov 28, 2024
cd5593c
fix: undefined accessibility label
OtavioStasiak Nov 28, 2024
caae3af
chore: updated translations
OtavioStasiak Nov 28, 2024
52d48d0
chore: update validations
OtavioStasiak Nov 28, 2024
cf8ca1c
chore: updated E2EEnterYourPasswordView layout
OtavioStasiak Nov 18, 2024
6a6b108
fix: added label on show and hide password input
OtavioStasiak Nov 22, 2024
6162fef
action: organized translations
OtavioStasiak Nov 22, 2024
033a508
fix: label on closeButton
OtavioStasiak Nov 22, 2024
3ac3ff5
fix: lint
OtavioStasiak Nov 22, 2024
e78fc2a
chore: pt-br translation
OtavioStasiak Nov 28, 2024
5569f9c
action: organized translations
OtavioStasiak Nov 28, 2024
45bb598
chore: improve code organization
OtavioStasiak Nov 28, 2024
5dcba04
fix: updated e2e tests
OtavioStasiak Nov 28, 2024
ed5234b
fix: changeserver e2e test
OtavioStasiak Nov 29, 2024
2f0aa23
fix: e2eencryption e2e test
OtavioStasiak Nov 29, 2024
b1dafce
fix: e2e tests breaking
OtavioStasiak Nov 29, 2024
a67aa37
fix: flaky e2e android e2eencryption test
OtavioStasiak Nov 29, 2024
e21fc4e
fix: e2e deeplinking test
OtavioStasiak Nov 29, 2024
9569d65
fix: dismiss keyboard on e2e register tests
OtavioStasiak Nov 29, 2024
01ce195
fix: changeserver e2e on android
OtavioStasiak Nov 29, 2024
5b95828
fix: changeuser e2e tests
OtavioStasiak Nov 30, 2024
b270716
fix: added onSubmitEditing on registerView confirmPassword
OtavioStasiak Nov 30, 2024
d604c2d
fix: e2e tests
OtavioStasiak Nov 30, 2024
b270fc0
fix: update e2eencryption test
OtavioStasiak Dec 3, 2024
b513acb
chore: updated a11y accessibility experience on password conditions
OtavioStasiak Dec 4, 2024
9c3cfad
fix: i18n labels
OtavioStasiak Dec 5, 2024
5d81282
action: organized translations
OtavioStasiak Dec 5, 2024
8c14c32
fix: color and issues about a11y
OtavioStasiak Dec 5, 2024
e6bac6e
fix: updated style and colors
OtavioStasiak Dec 6, 2024
ff8ceca
fix: lint
OtavioStasiak Dec 6, 2024
c1d7110
fix: rollback merge
OtavioStasiak Dec 6, 2024
6ffe222
fix: updated translation
OtavioStasiak Dec 11, 2024
31e717b
fix: formTextInput accessibilityLabel
OtavioStasiak Dec 11, 2024
0d3fa19
fix: removed comment
OtavioStasiak Dec 11, 2024
4de5604
chore: created CustomFields component, useVerifyPassword and useCusto…
OtavioStasiak Dec 11, 2024
907ad74
fix: new customFields rules and rename PasswordTips
OtavioStasiak Dec 11, 2024
a958494
fix: lint
OtavioStasiak Dec 11, 2024
447e715
fix: buttonBackgroundSecondaryDefault color
OtavioStasiak Dec 11, 2024
c863edc
fix: focus problem on iOS voiceOver
OtavioStasiak Dec 11, 2024
fc4caf1
fix: iOS experience and android title focus
OtavioStasiak Dec 12, 2024
aec123d
fix: podfile
OtavioStasiak Dec 12, 2024
689f8b5
fix: accessibility label
OtavioStasiak Dec 12, 2024
77563e7
fix: removed accesibility period on Android
OtavioStasiak Dec 13, 2024
314c77a
fix: removed a11y-order
OtavioStasiak Jan 7, 2025
7463f50
fix: updated PasswordPolicies comment
OtavioStasiak Jan 9, 2025
afa08c2
fix: return null instead fragment
OtavioStasiak Jan 9, 2025
a83a214
fix: input text entry style
OtavioStasiak Jan 9, 2025
f56d0ec
fix: type useCustomFields
OtavioStasiak Jan 9, 2025
1060edd
fix: customFields focus
OtavioStasiak Jan 10, 2025
ab53634
fix: archive name and handlesubmit of reeact-hook-form
OtavioStasiak Jan 10, 2025
a444257
Merge branch 'develop' into chore-a11y-signup
OtavioStasiak Jan 10, 2025
44f34a2
Merge branch 'develop' into chore-a11y-signup
diegolmello Jan 10, 2025
7bb270a
Merge branch 'develop' into chore-a11y-signup
diegolmello Feb 13, 2025
d0523c4
Merge branch 'develop' into chore-a11y-signup
OtavioStasiak Feb 19, 2025
628fd75
fix: updated ternary operator of password policies
OtavioStasiak Feb 19, 2025
3d771e7
fix: password policies validating password before fill the fields
OtavioStasiak Feb 19, 2025
0639425
fix: call isValid function
OtavioStasiak Feb 19, 2025
2b5da30
fix: conditiional for forbitRepeatingCharacters regex
OtavioStasiak Feb 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified android/app/src/main/assets/fonts/custom.ttf
Binary file not shown.
77 changes: 77 additions & 0 deletions app/containers/CustomFields/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from 'react';
import RNPickerSelect from 'react-native-picker-select';

import { FormTextInput } from '../TextInput';
import useParsedCustomFields from '../../lib/hooks/useCustomFields';

interface ICustomFields {
Accounts_CustomFields: string;
customFields: any;
onCustomFieldChange: (value: any) => void;
}

const CustomFields = ({ Accounts_CustomFields, customFields, onCustomFieldChange }: ICustomFields) => {
const { parsedCustomFields } = useParsedCustomFields(Accounts_CustomFields);

if (!Accounts_CustomFields) {
return null;
}
try {
return Object.keys(parsedCustomFields).map((key: string, index: number, array: any) => {
if (parsedCustomFields[key].type === 'select') {
const options = parsedCustomFields[key].options.map((option: string) => ({ label: option, value: option }));
return (
<RNPickerSelect
key={key}
items={options}
onValueChange={value => {
const newValue: { [key: string]: string } = {};
newValue[key] = value;
onCustomFieldChange({ ...customFields, ...newValue });
}}
value={customFields[key]}>
<FormTextInput
inputRef={e => {
// @ts-ignore
this[key] = e;
}}
required={parsedCustomFields[key]?.required}
label={key}
value={customFields[key]}
testID='settings-view-language'
/>
</RNPickerSelect>
);
}
return (
<FormTextInput
inputRef={e => {
// @ts-ignore
this[key] = e;
}}
key={key}
label={key}
value={customFields[key]}
onChangeText={value => {
const newValue: { [key: string]: string } = {};
newValue[key] = value;
onCustomFieldChange({ ...customFields, ...newValue });
}}
onSubmitEditing={() => {
if (array.length - 1 > index) {
// @ts-ignore
return this[array[index + 1]].focus();
}
}}
required={parsedCustomFields[key]?.required}
maxLength={parsedCustomFields[key]?.maxLength ?? undefined}
containerStyle={{ marginBottom: 0, marginTop: 0 }}
/>
);
});
} catch (error) {
return null;
}
};

export default CustomFields;
2 changes: 2 additions & 0 deletions app/containers/CustomIcon/mappedIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const mappedIcons = {
'encrypted': 59730,
'engagement-dashboard': 59731,
'enterprise-feature': 59732,
'error-circle': 59867,
'facebook-monochromatic': 59733,
'federation': 59652,
'federation-disabled': 59651,
Expand Down Expand Up @@ -192,6 +193,7 @@ export const mappedIcons = {
'status-offline': 59744,
'status-online': 59745,
'strike': 59846,
'success-circle': 59855,
'sun': 59847,
'support': 59848,
'team': 59849,
Expand Down
2 changes: 1 addition & 1 deletion app/containers/CustomIcon/selection.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions app/containers/LoginServices/ServicesSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import I18n from '../../i18n';
import { IServicesSeparator } from './interfaces';

const ServicesSeparator = ({ services, separator, collapsed, onPress }: IServicesSeparator) => {
const { colors, theme } = useTheme();
const { colors } = useTheme();

const { length } = Object.values(services);

Expand All @@ -22,12 +22,12 @@ const ServicesSeparator = ({ services, separator, collapsed, onPress }: IService
style={styles.options}
color={colors.fontHint}
/>
<OrSeparator theme={theme} />
<OrSeparator />
</>
);
}
if (length > 0 && separator) {
return <OrSeparator theme={theme} />;
return <OrSeparator />;
}
return null;
};
Expand Down
27 changes: 16 additions & 11 deletions app/containers/LoginServices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ import { SERVICES_COLLAPSED_HEIGHT, SERVICE_HEIGHT } from './styles';
import ServicesSeparator from './ServicesSeparator';
import Service from './Service';

const ServiceList = ({ services, CAS_enabled, CAS_login_url, Gitlab_URL, server }: IServiceList) => (
const ServiceList = ({ services, CAS_enabled, CAS_login_url, Gitlab_URL, server, collapsed }: IServiceList) => (
<>
{Object.values(services).map((service: IItemService) => (
<Service
key={service._id}
CAS_enabled={CAS_enabled}
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
service={service}
/>
))}
{Object.values(services).map((service: IItemService, index: number) => {
if (index > 2 && collapsed) return <></>;
return (
<Service
key={service._id}
CAS_enabled={CAS_enabled}
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
service={service}
/>
);
})}
</>
);

Expand Down Expand Up @@ -61,6 +64,7 @@ const LoginServices = ({ separator }: { separator: boolean }): React.ReactElemen
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
collapsed={collapsed}
/>
</Animated.View>
<ServicesSeparator services={services} separator={separator} collapsed={collapsed} onPress={onPressButtonSeparator} />
Expand All @@ -75,6 +79,7 @@ const LoginServices = ({ separator }: { separator: boolean }): React.ReactElemen
CAS_login_url={CAS_login_url}
Gitlab_URL={Gitlab_URL}
server={server}
collapsed={collapsed}
/>
<ServicesSeparator services={services} separator={separator} collapsed={collapsed} onPress={onPressButtonSeparator} />
</>
Expand Down
1 change: 1 addition & 0 deletions app/containers/LoginServices/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface IServiceList {
CAS_login_url: string;
Gitlab_URL: string;
server: string;
collapsed: boolean;
}

export interface IServicesSeparator {
Expand Down
20 changes: 8 additions & 12 deletions app/containers/OrSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { StyleSheet, Text, View } from 'react-native';

import I18n from '../i18n';
import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants';
import { TSupportedThemes } from '../theme';
import { useTheme } from '../theme';

const styles = StyleSheet.create({
container: {
Expand All @@ -17,22 +16,19 @@ const styles = StyleSheet.create({
flex: 1
},
text: {
fontSize: 14,
marginLeft: 14,
marginRight: 14,
fontSize: 16,
marginHorizontal: 12,
...sharedStyles.textMedium
}
});

interface IOrSeparator {
theme: TSupportedThemes;
}
const OrSeparator = React.memo(() => {
const { colors } = useTheme();
const line = { backgroundColor: colors.strokeLight };
const text = { color: colors.fontSecondaryInfo };

const OrSeparator = React.memo(({ theme }: IOrSeparator) => {
const line = { backgroundColor: themes[theme].strokeLight };
const text = { color: themes[theme].fontSecondaryInfo };
return (
<View style={styles.container}>
<View accessible style={styles.container}>
<View style={[styles.line, line]} />
<Text style={[styles.text, text]}>{I18n.t('OR')}</Text>
<View style={[styles.line, line]} />
Expand Down
14 changes: 10 additions & 4 deletions app/containers/TextInput/FormTextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BottomSheetTextInput } from '@discord/bottom-sheet';
import React, { useState } from 'react';
import { StyleProp, StyleSheet, Text, TextInput as RNTextInput, TextInputProps, TextStyle, View, ViewStyle } from 'react-native';
import { BottomSheetTextInput } from '@discord/bottom-sheet';
import Touchable from 'react-native-platform-touchable';

import i18n from '../../i18n';
Expand All @@ -9,6 +9,7 @@ import sharedStyles from '../../views/Styles';
import ActivityIndicator from '../ActivityIndicator';
import { CustomIcon, TIconsName } from '../CustomIcon';
import { TextInput } from './TextInput';
import { isIOS } from '../../lib/methods/helpers';

const styles = StyleSheet.create({
error: {
Expand Down Expand Up @@ -97,10 +98,12 @@ export const FormTextInput = ({
const [showPassword, setShowPassword] = useState(false);
const showClearInput = onClearInput && value && value.length > 0;
const Input = bottomSheet ? BottomSheetTextInput : TextInput;
const accessibilityLabelRequired = required ? `, ${i18n.t('Required')}` : '';
const accessibilityInputValue = (!secureTextEntry && value && isIOS) || showPassword ? `, ${value}` : '';
return (
<View
accessible
accessibilityLabel={`${label} - ${required ? i18n.t('Required') : ''}`}
accessibilityLabel={accessibilityLabel ?? `${label}${accessibilityLabelRequired}${accessibilityInputValue}`}
style={[styles.inputContainer, containerStyle]}>
{label ? (
<Text style={[styles.label, { color: colors.fontTitlesLabels }, error?.error && { color: colors.fontDanger }]}>
Expand All @@ -109,7 +112,7 @@ export const FormTextInput = ({
</Text>
) : null}

<View style={styles.wrap}>
<View accessible style={styles.wrap}>
<Input
style={[
styles.input,
Expand Down Expand Up @@ -167,7 +170,10 @@ export const FormTextInput = ({
) : null}

{secureTextEntry ? (
<Touchable onPress={() => setShowPassword(!showPassword)} style={[styles.iconContainer, styles.iconRight]}>
<Touchable
accessible
accessibilityLabel={showPassword ? i18n.t('Hide_Password') : i18n.t('Show_Password')}
onPress={() => setShowPassword(!showPassword)}>
<CustomIcon
name={showPassword ? 'unread-on-top' : 'unread-on-top-disabled'}
testID={testID ? `${testID}-icon-password` : undefined}
Expand Down
22 changes: 11 additions & 11 deletions app/containers/Touch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ const Touch = React.forwardRef<RectButton, ITouchProps>(
const { colors } = useTheme();

return (
// container for accessibility
<View accessible={accessible} accessibilityLabel={accessibilityLabel} accessibilityRole='button'>
<RectButton
ref={ref}
onPress={onPress}
activeOpacity={1}
underlayColor={underlayColor || colors.surfaceNeutral}
rippleColor={colors.surfaceNeutral}
{...props}>
<RectButton
ref={ref}
onPress={onPress}
activeOpacity={1}
underlayColor={underlayColor || colors.surfaceNeutral}
rippleColor={colors.surfaceNeutral}
{...props}
style={{}}>
<View accessible={accessible} accessibilityLabel={accessibilityLabel} accessibilityRole='button' style={props.style}>
{children}
</RectButton>
</View>
</View>
</RectButton>
);
}
);
Expand Down
14 changes: 14 additions & 0 deletions app/i18n/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
"are_typing": "يكتب",
"Are_you_sure_question_mark": "هل أنت متأكد؟",
"Are_you_sure_you_want_to_leave_the_room": "متأكد من مغادرة الغرفة {{room}}؟",
"At_Least_1_Lowercase_Letter": "رسالة صغيرة على الأقل",
"At_Least_1_Number": "رقم واحد على الأقل",
"At_Least_1_Symbol": "رمز واحد على الأقل",
"At_Least_1_Uppercase_Letter": "على الأقل حرف واحد كبير",
"At_Least_Characters": "على الأقل {{quantity}} حرفًا",
"At_Most_24_Characters": "على الأقل 24 حرفًا",
"At_Most_Characters": "بحد أقصى {{quantity}} حرفًا",
"Audio": "صوت",
"Auto_Translate": "ترجمة تلقائية",
"Automatic": "تلقائي",
Expand Down Expand Up @@ -71,6 +78,7 @@
"Code_or_password_invalid": "الرمز أو كلمة المرور خاطئة",
"Collaborative": "تعاونية",
"Confirm": "تأكيد",
"Confirm_Password": "تأكيد كلمة المرور",
"Connect": "اتصال",
"Connecting": "جار الاتصال...",
"Contact_us": "تواصل معنا",
Expand Down Expand Up @@ -172,6 +180,7 @@
"Get_help": "احصل على المساعدة",
"Glossary_of_simplified_terms": "مسرد المصطلحات المبسطة",
"Help": "مساعدة",
"Hide_Password": "إخفاء كلمة المرور",
"Hide_room": "إخفاء",
"Hide_System_Messages": "إخفاء رسائل النظام",
"Hide_type_messages": "إخفاء رسائل \"{{type}}\"",
Expand Down Expand Up @@ -231,6 +240,7 @@
"Mark_unread": "علامة غير مقروء",
"Max_number_of_users_allowed_is_number": "أقصى عدد للمستخدمين {{maxUsers}}",
"Max_number_of_uses": "أقصى عدد للاستخدام",
"Max_Repeating_Characters": "الحد الأقصى. {{quantity}} من الأحرف المتكررة",
"Members": "أفراد",
"members": "أفراد",
"Mentions": "الإشارات",
Expand Down Expand Up @@ -312,6 +322,8 @@
"Passcode_choose_title": "اختر كلمة المرور الجديدة",
"Passcode_enter_title": "أدخل كلمة المرور",
"Password": "كلمة المرور",
"Password_Tip_Error": "الشرط غير محقق.",
"Password_Tip_Success": "تم استيفاء الشرط.",
"Permalink_copied_to_clipboard": "تم نسخ الرابط الثابت إلى الحافظة!",
"Phone": "الهاتف",
"Pin": "ثبت",
Expand Down Expand Up @@ -406,6 +418,7 @@
"Share_Link": "مشاركة رابط",
"Share_this_app": "مشاركة هذا البرنامج",
"Show_more": "إظهار أكثر",
"Show_Password": "عرض كلمة المرور",
"Show_the_keyboard_shortcut_list": "عرض قائمة اختصارات لوحة المفاتيح",
"Sign_Up": "تسجيل جديد",
"Slash_Gimme_Description": "يعرض ༼ つ ◕_◕ ༽つ قبل رسالتك",
Expand Down Expand Up @@ -505,5 +518,6 @@
"Your_invite_link_will_expire_on__date__or_after__usesLeft__uses": "ستنتهي صلاحية رابط الدعوة الخاص بك في {{date}} أو بعد {{usesLeft}} استخدامات",
"Your_invite_link_will_never_expire": "لن تنتهي صلاحية رابط الدعوة الخاص بك",
"Your_password_is": "كلمة المرور الخاصة بك هي",
"Your_Password_Must_Have": "يجب أن تحتوي كلمة المرور الخاصة بك على:",
"Your_workspace": "مساحة عملك"
}
Loading