From 0a7ee67707f0cbd0357442ae33f8a5cb602d22c2 Mon Sep 17 00:00:00 2001 From: christine betts Date: Fri, 10 Oct 2025 15:34:44 -0400 Subject: [PATCH] Show notification in screen reader mode (#10900) --- docs/get-started/configuration.md | 5 +++++ packages/cli/src/config/settingsSchema.ts | 2 +- .../cli/src/ui/components/Notifications.tsx | 22 ++++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/get-started/configuration.md b/docs/get-started/configuration.md index 1fe44e7388..955f0392f4 100644 --- a/docs/get-started/configuration.md +++ b/docs/get-started/configuration.md @@ -160,6 +160,11 @@ their corresponding top-level category object in your `settings.json` file. - **Description:** Disable loading phrases for accessibility. - **Default:** `false` +- **`ui.accessibility.screenReader`** (boolean): + - **Description:** Show plaintext interactive view that is more screen reader + friendly. + - **Default:** `false` + - **`ui.customWittyPhrases`** (array of strings): - **Description:** A list of custom phrases to display during loading states. When provided, the CLI will cycle through these phrases instead of the diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index 9e9f71d5c0..3b5cfd8604 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -452,7 +452,7 @@ const SETTINGS_SCHEMA = { label: 'Screen Reader Mode', category: 'UI', requiresRestart: true, - default: undefined as boolean | undefined, + default: false, description: 'Render output in plain-text to be more screen reader accessible', showInDialog: true, diff --git a/packages/cli/src/ui/components/Notifications.tsx b/packages/cli/src/ui/components/Notifications.tsx index a287b10524..4d225cf6c1 100644 --- a/packages/cli/src/ui/components/Notifications.tsx +++ b/packages/cli/src/ui/components/Notifications.tsx @@ -4,27 +4,43 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Box, Text } from 'ink'; +import { Box, Text, useIsScreenReaderEnabled } from 'ink'; import { useAppContext } from '../contexts/AppContext.js'; import { useUIState } from '../contexts/UIStateContext.js'; import { theme } from '../semantic-colors.js'; import { StreamingState } from '../types.js'; import { UpdateNotification } from './UpdateNotification.js'; +import { homedir } from 'node:os'; +import path from 'node:path'; + +const settingsPath = path.join(homedir(), '.gemini', 'settings.json'); + export const Notifications = () => { const { startupWarnings } = useAppContext(); const { initError, streamingState, updateInfo } = useUIState(); - + const isScreenReaderEnabled = useIsScreenReaderEnabled(); const showStartupWarnings = startupWarnings.length > 0; const showInitError = initError && streamingState !== StreamingState.Responding; - if (!showStartupWarnings && !showInitError && !updateInfo) { + if ( + !showStartupWarnings && + !showInitError && + !updateInfo && + !isScreenReaderEnabled + ) { return null; } return ( <> + {isScreenReaderEnabled && ( + + You are currently in screen reader-friendly view. To switch out, open{' '} + {settingsPath} and remove the entry for {'"screenReader"'}. + + )} {updateInfo && } {showStartupWarnings && (