Skip to content

Commit 9defae4

Browse files
authored
Cherrypick #10900 (#11116)
1 parent f0eb01c commit 9defae4

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

docs/get-started/configuration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ Settings are organized into categories. All settings should be placed within the
123123
- **Description:** Disable loading phrases for accessibility.
124124
- **Default:** `false`
125125

126+
- **`ui.accessibility.screenReader`** (boolean):
127+
- **Description:** Show plaintext interactive view that is more screen reader
128+
friendly.
129+
- **Default:** `false`
130+
126131
- **`ui.customWittyPhrases`** (array of strings):
127132
- **Description:** A list of custom phrases to display during loading states. When provided, the CLI will cycle through these phrases instead of the default ones.
128133
- **Default:** `[]`

packages/cli/src/config/settingsSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ const SETTINGS_SCHEMA = {
443443
label: 'Screen Reader Mode',
444444
category: 'UI',
445445
requiresRestart: true,
446-
default: undefined as boolean | undefined,
446+
default: false,
447447
description:
448448
'Render output in plain-text to be more screen reader accessible',
449449
showInDialog: true,

packages/cli/src/ui/components/Notifications.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,43 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import { Box, Text } from 'ink';
7+
import { Box, Text, useIsScreenReaderEnabled } from 'ink';
88
import { useAppContext } from '../contexts/AppContext.js';
99
import { useUIState } from '../contexts/UIStateContext.js';
1010
import { theme } from '../semantic-colors.js';
1111
import { StreamingState } from '../types.js';
1212
import { UpdateNotification } from './UpdateNotification.js';
1313

14+
import { homedir } from 'node:os';
15+
import path from 'node:path';
16+
17+
const settingsPath = path.join(homedir(), '.gemini', 'settings.json');
18+
1419
export const Notifications = () => {
1520
const { startupWarnings } = useAppContext();
1621
const { initError, streamingState, updateInfo } = useUIState();
17-
22+
const isScreenReaderEnabled = useIsScreenReaderEnabled();
1823
const showStartupWarnings = startupWarnings.length > 0;
1924
const showInitError =
2025
initError && streamingState !== StreamingState.Responding;
2126

22-
if (!showStartupWarnings && !showInitError && !updateInfo) {
27+
if (
28+
!showStartupWarnings &&
29+
!showInitError &&
30+
!updateInfo &&
31+
!isScreenReaderEnabled
32+
) {
2333
return null;
2434
}
2535

2636
return (
2737
<>
38+
{isScreenReaderEnabled && (
39+
<Text>
40+
You are currently in screen reader-friendly view. To switch out, open{' '}
41+
{settingsPath} and remove the entry for {'"screenReader"'}.
42+
</Text>
43+
)}
2844
{updateInfo && <UpdateNotification message={updateInfo.message} />}
2945
{showStartupWarnings && (
3046
<Box

0 commit comments

Comments
 (0)