From 87f231d582bc5a56a5a2cf0734c79f53b03f6c9a Mon Sep 17 00:00:00 2001 From: Labhansh Agrawal Date: Tue, 24 Nov 2020 18:48:50 +0530 Subject: [PATCH] add screenReaderMode option --- .github/workflows/nodejs.yml | 1 + app/config/config-default.js | 3 +++ lib/components/term-group.tsx | 1 + lib/components/term.tsx | 3 ++- lib/components/terms.tsx | 1 + lib/config.d.ts | 1 + lib/containers/terms.ts | 3 ++- lib/hyper.d.ts | 3 +++ lib/reducers/ui.ts | 7 ++++++- 9 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 42e09674..ee90d313 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -4,6 +4,7 @@ on: branches: - master - canary + - screenreader pull_request: defaults: run: diff --git a/app/config/config-default.js b/app/config/config-default.js index cafa6599..53b81b99 100644 --- a/app/config/config-default.js +++ b/app/config/config-default.js @@ -160,6 +160,9 @@ module.exports = { // set to true to disable auto updates disableAutoUpdates: false, + // set to true to enable screen reading apps (like NVDA) to read the contents of the terminal + screenReaderMode: false, + // for advanced config flags please refer to https://hyper.is/#cfg }, diff --git a/lib/components/term-group.tsx b/lib/components/term-group.tsx index 2b6a152b..a0a0f691 100644 --- a/lib/components/term-group.tsx +++ b/lib/components/term-group.tsx @@ -104,6 +104,7 @@ class TermGroup_ extends React.PureComponent { webLinksActivationKey: this.props.webLinksActivationKey, macOptionSelectionMode: this.props.macOptionSelectionMode, disableLigatures: this.props.disableLigatures, + screenReaderMode: this.props.screenReaderMode, uid }); diff --git a/lib/components/term.tsx b/lib/components/term.tsx index 9bdf5dd0..352f7026 100644 --- a/lib/components/term.tsx +++ b/lib/components/term.tsx @@ -77,7 +77,8 @@ const getTermOptions = (props: TermProps): ITerminalOptions => { brightMagenta: props.colors.lightMagenta, brightCyan: props.colors.lightCyan, brightWhite: props.colors.lightWhite - } + }, + screenReaderMode: props.screenReaderMode }; }; diff --git a/lib/components/terms.tsx b/lib/components/terms.tsx index 3f497613..1ba2040c 100644 --- a/lib/components/terms.tsx +++ b/lib/components/terms.tsx @@ -116,6 +116,7 @@ export default class Terms extends React.Component { webLinksActivationKey: this.props.webLinksActivationKey, macOptionSelectionMode: this.props.macOptionSelectionMode, disableLigatures: this.props.disableLigatures, + screenReaderMode: this.props.screenReaderMode, parentProps: this.props }); diff --git a/lib/config.d.ts b/lib/config.d.ts index ee637050..ce0e6c13 100644 --- a/lib/config.d.ts +++ b/lib/config.d.ts @@ -51,6 +51,7 @@ export type configOptions = { }; padding: string; quickEdit: boolean; + screenReaderMode: boolean; scrollback: number; selectionColor: string; shell: string; diff --git a/lib/containers/terms.ts b/lib/containers/terms.ts index 3c289a67..346545ff 100644 --- a/lib/containers/terms.ts +++ b/lib/containers/terms.ts @@ -45,7 +45,8 @@ const mapStateToProps = (state: HyperState) => { webGLRenderer: state.ui.webGLRenderer, webLinksActivationKey: state.ui.webLinksActivationKey, macOptionSelectionMode: state.ui.macOptionSelectionMode, - disableLigatures: state.ui.disableLigatures + disableLigatures: state.ui.disableLigatures, + screenReaderMode: state.ui.screenReaderMode }; }; diff --git a/lib/hyper.d.ts b/lib/hyper.d.ts index 97e3eca7..d2941ad7 100644 --- a/lib/hyper.d.ts +++ b/lib/hyper.d.ts @@ -79,6 +79,7 @@ export type uiState = Immutable<{ quickEdit: boolean; resizeAt: number; rows: number | null; + screenReaderMode: boolean; scrollback: number; selectionColor: string; showHamburgerMenu: boolean | ''; @@ -287,6 +288,7 @@ export type TermGroupOwnProps = { | 'onTitle' | 'padding' | 'quickEdit' + | 'screenReaderMode' | 'scrollback' | 'selectionColor' | 'sessions' @@ -344,6 +346,7 @@ export type TermProps = { padding: string; quickEdit: boolean; rows: number | null; + screenReaderMode: boolean; scrollback: number; search: boolean; searchAddon: SearchAddon | null; diff --git a/lib/reducers/ui.ts b/lib/reducers/ui.ts index 85c1943c..4a432d53 100644 --- a/lib/reducers/ui.ts +++ b/lib/reducers/ui.ts @@ -107,7 +107,8 @@ const initial: uiState = Immutable>({ webGLRenderer: true, webLinksActivationKey: '', macOptionSelectionMode: 'vertical', - disableLigatures: true + disableLigatures: true, + screenReaderMode: false }); const reducer: IUiReducer = (state = initial, action) => { @@ -264,6 +265,10 @@ const reducer: IUiReducer = (state = initial, action) => { ret.disableLigatures = config.disableLigatures; } + if (config.screenReaderMode !== undefined) { + ret.screenReaderMode = config.screenReaderMode; + } + ret._lastUpdate = now; return ret;