Skip to content
Merged
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/get-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,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 @@ -443,7 +443,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

This hardcoded path to the user settings file is problematic because the screenReader setting can be configured in multiple locations (e.g., project or system-level files). Instructing the user to edit this specific file can be misleading. As this constant and its imports will be unused with the suggested change to the notification message, these lines should be removed.


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 +38 to +43

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

To avoid confusing users by pointing them to a potentially incorrect settings file, the notification message should be made more generic. Instead of a specific file path, it's better to refer to the setting name. Ideally, you could guide them to use the settings dialog, since showInDialog is enabled for this option.

Suggested change
{isScreenReaderEnabled && (
<Text>
You are currently in screen reader-friendly view. To switch out, open{' '}
{settingsPath} and remove the entry for {'"screenReader"'}.
</Text>
)}
{isScreenReaderEnabled && (
<Text>
You are currently in screen reader-friendly view. To switch out, disable
the 'ui.accessibility.screenReader' setting in your Gemini
configuration.
</Text>
)}

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