Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/cli/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ Settings are organized into categories. All settings should be placed within the
- **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 default ones.
- **Default:** `[]`
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/config/settingsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,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,
Expand Down
22 changes: 19 additions & 3 deletions packages/cli/src/ui/components/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Comment on lines +14 to +17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Hardcoding the path to the settings file is brittle. The Gemini CLI supports multiple configuration files with a specific order of precedence (e.g., user, project, system). If the screen reader setting is enabled in a higher-precedence file like a project's .gemini/settings.json, editing the user-level file at the hardcoded path will not disable the feature, leading to user confusion.

This path logic should be removed from the UI component. The path, if needed, should be provided by the application's configuration service.


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 && (
<Text>
You are currently in screen reader-friendly view. To switch out, open{' '}
{settingsPath} and remove the entry for {'"screenReader"'}.
</Text>
Comment on lines +39 to +42

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The instruction to the user is ambiguous and relies on a hardcoded path that may be incorrect. The setting is ui.accessibility.screenReader, but the message only refers to "screenReader". Also, it suggests removing the entry, when setting it to false is the correct way to disable it.

A clearer and safer message would be to instruct the user on the setting they need to change, without specifying a file path.

        <Text>
          You are currently in screen reader-friendly view. To switch out, set `ui.accessibility.screenReader` to `false` in your settings file.
        </Text>

)}
{updateInfo && <UpdateNotification message={updateInfo.message} />}
{showStartupWarnings && (
<Box
Expand Down
Loading