From 157ad2c0cd16a586312b8140e66592b3b270577a Mon Sep 17 00:00:00 2001 From: pedr Date: Mon, 20 Jan 2025 14:34:36 -0300 Subject: [PATCH] Desktop: Resolves #11621: Accessibility: Add status update after update (#11634) --- packages/app-desktop/gui/NoteList/NoteList2.tsx | 5 ++++- packages/app-desktop/gui/SearchBar/SearchBar.tsx | 1 + packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/app-desktop/gui/NoteList/NoteList2.tsx b/packages/app-desktop/gui/NoteList/NoteList2.tsx index db09d1b08e8..d5962875cba 100644 --- a/packages/app-desktop/gui/NoteList/NoteList2.tsx +++ b/packages/app-desktop/gui/NoteList/NoteList2.tsx @@ -201,7 +201,9 @@ const NoteList = (props: Props) => { const renderEmptyList = () => { if (props.notes.length) return null; - return
{getEmptyFolderMessage(props.folders, props.selectedFolderId)}
; + // Role status is necessary for the screenreader to announce that the list is empty, since when there are + // zero items there is not list to render + return
{getEmptyFolderMessage(props.folders, props.selectedFolderId)}
; }; const renderFiller = (key: string, style: React.CSSProperties) => { @@ -306,6 +308,7 @@ const NoteList = (props: Props) => { onKeyUp={onKeyUp} onDrop={onDrop} onContextMenu={onContainerContextMenu} + id='notes-list' > {renderEmptyList()} {renderFiller('top', topFillerStyle)} diff --git a/packages/app-desktop/gui/SearchBar/SearchBar.tsx b/packages/app-desktop/gui/SearchBar/SearchBar.tsx index a3b9bc0161e..24934841856 100644 --- a/packages/app-desktop/gui/SearchBar/SearchBar.tsx +++ b/packages/app-desktop/gui/SearchBar/SearchBar.tsx @@ -174,6 +174,7 @@ function SearchBar(props: Props) { onKeyDown={onKeyDown} onSearchButtonClick={onSearchButtonClick} searchStarted={searchStarted} + aria-controls='notes-list' /> ); diff --git a/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx b/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx index 41bab0b9614..effa1fff942 100644 --- a/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx +++ b/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx @@ -51,6 +51,7 @@ interface Props { searchStarted: boolean; placeholder?: string; disabled?: boolean; + 'aria-controls'?: string; } export interface OnChangeEvent { @@ -79,6 +80,7 @@ export default function(props: Props) { onKeyDown={props.onKeyDown} spellCheck={false} disabled={props.disabled} + aria-controls={props['aria-controls']} />