You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Desktop: Resolves #11741: Accessibility: Add screen reader announcements when toggling the note list and/or sidebar (#11776)
This commit is contained in:
@@ -2,10 +2,13 @@ import * as React from 'react';
|
||||
import { useMemo, useRef } from 'react';
|
||||
import { DialogState } from '../types';
|
||||
import { PrintCallback } from './usePrintToCallback';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import announceForAccessibility from '../../utils/announceForAccessibility';
|
||||
|
||||
export interface WindowControl {
|
||||
setState: (update: Partial<DialogState>)=> void;
|
||||
printTo: PrintCallback;
|
||||
announcePanelVisibility(panelName: string, visible: boolean): void;
|
||||
}
|
||||
|
||||
export type OnSetDialogState = React.Dispatch<React.SetStateAction<DialogState>>;
|
||||
@@ -24,6 +27,11 @@ const useWindowControl = (setDialogState: OnSetDialogState, onPrint: PrintCallba
|
||||
}));
|
||||
},
|
||||
printTo: (target, options) => onPrintRef.current(target, options),
|
||||
announcePanelVisibility: (panelName, visible) => {
|
||||
announceForAccessibility(
|
||||
visible ? _('Panel "%s" is visible', panelName) : _('Panel %s is hidden', panelName),
|
||||
);
|
||||
},
|
||||
};
|
||||
}, [setDialogState]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user