mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
Mobile: Improve accessibility of side menu (#8839)
This commit is contained in:
parent
e041169300
commit
78ffc0bc23
@ -23,6 +23,7 @@ Icon.loadFont().catch((error: any) => { console.info(error); });
|
||||
interface Props {
|
||||
syncStarted: boolean;
|
||||
themeId: number;
|
||||
sideMenuVisible: boolean;
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||
dispatch: Function;
|
||||
collapsedFolderIds: string[];
|
||||
@ -491,15 +492,29 @@ const SideMenuContentComponent = (props: Props) => {
|
||||
items = items.concat(folderItems);
|
||||
}
|
||||
|
||||
const isHidden = !props.sideMenuVisible;
|
||||
|
||||
const style = {
|
||||
flex: 1,
|
||||
borderRightWidth: 1,
|
||||
borderRightColor: theme.dividerColor,
|
||||
backgroundColor: theme.backgroundColor,
|
||||
|
||||
// Have the UI reflect whether the View is hidden to the screen reader.
|
||||
// This way, there will be visual feedback if isHidden is incorrect.
|
||||
opacity: isHidden ? 0.5 : undefined,
|
||||
};
|
||||
|
||||
// Note: iOS uses accessibilityElementsHidden and Android uses importantForAccessibility
|
||||
// to hide elements from the screenreader.
|
||||
|
||||
return (
|
||||
<View style={style}>
|
||||
<View
|
||||
style={style}
|
||||
|
||||
accessibilityElementsHidden={isHidden}
|
||||
importantForAccessibility={isHidden ? 'no-hide-descendants' : undefined}
|
||||
>
|
||||
<View style={{ flex: 1, opacity: props.opacity }}>
|
||||
<ScrollView scrollsToTop={false} style={styles_.menu}>
|
||||
{items}
|
||||
@ -520,6 +535,7 @@ export default connect((state: AppState) => {
|
||||
notesParentType: state.notesParentType,
|
||||
locale: state.settings.locale,
|
||||
themeId: state.settings.theme,
|
||||
sideMenuVisible: state.showSideMenu,
|
||||
// Don't do the opacity animation as it means re-rendering the list multiple times
|
||||
// opacity: state.sideMenuOpenPercent,
|
||||
collapsedFolderIds: state.collapsedFolderIds,
|
||||
|
@ -22,14 +22,14 @@ import handleShared from './utils/shareHandler';
|
||||
import uuid from '@joplin/lib/uuid';
|
||||
import { loadKeychainServiceAndSettings } from '@joplin/lib/services/SettingUtils';
|
||||
import KeychainServiceDriverMobile from '@joplin/lib/services/keychain/KeychainServiceDriver.mobile';
|
||||
import { setLocale } from '@joplin/lib/locale';
|
||||
import { _, setLocale } from '@joplin/lib/locale';
|
||||
import SyncTargetJoplinServer from '@joplin/lib/SyncTargetJoplinServer';
|
||||
import SyncTargetJoplinCloud from '@joplin/lib/SyncTargetJoplinCloud';
|
||||
import SyncTargetOneDrive from '@joplin/lib/SyncTargetOneDrive';
|
||||
import initProfile from '@joplin/lib/services/profileConfig/initProfile';
|
||||
const VersionInfo = require('react-native-version-info').default;
|
||||
const { Keyboard, BackHandler, Animated, View, StatusBar, Platform, Dimensions } = require('react-native');
|
||||
import { AppState as RNAppState, EmitterSubscription, Linking, NativeEventSubscription, Appearance } from 'react-native';
|
||||
import { AppState as RNAppState, EmitterSubscription, Linking, NativeEventSubscription, Appearance, AccessibilityInfo } from 'react-native';
|
||||
import getResponsiveValue from './components/getResponsiveValue';
|
||||
import NetInfo from '@react-native-community/netinfo';
|
||||
const DropdownAlert = require('react-native-dropdownalert').default;
|
||||
@ -984,6 +984,9 @@ class AppComponent extends React.Component {
|
||||
this.props.dispatch({
|
||||
type: isOpen ? 'SIDE_MENU_OPEN' : 'SIDE_MENU_CLOSE',
|
||||
});
|
||||
AccessibilityInfo.announceForAccessibility(
|
||||
isOpen ? _('Side menu opened') : _('Side menu closed')
|
||||
);
|
||||
}
|
||||
|
||||
private getSideMenuWidth = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user