add screenReaderMode option

This commit is contained in:
Labhansh Agrawal 2020-11-24 18:48:50 +05:30
parent f69e359554
commit 87f231d582
9 changed files with 20 additions and 3 deletions

View file

@ -4,6 +4,7 @@ on:
branches: branches:
- master - master
- canary - canary
- screenreader
pull_request: pull_request:
defaults: defaults:
run: run:

View file

@ -160,6 +160,9 @@ module.exports = {
// set to true to disable auto updates // set to true to disable auto updates
disableAutoUpdates: false, 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 // for advanced config flags please refer to https://hyper.is/#cfg
}, },

View file

@ -104,6 +104,7 @@ class TermGroup_ extends React.PureComponent<TermGroupProps> {
webLinksActivationKey: this.props.webLinksActivationKey, webLinksActivationKey: this.props.webLinksActivationKey,
macOptionSelectionMode: this.props.macOptionSelectionMode, macOptionSelectionMode: this.props.macOptionSelectionMode,
disableLigatures: this.props.disableLigatures, disableLigatures: this.props.disableLigatures,
screenReaderMode: this.props.screenReaderMode,
uid uid
}); });

View file

@ -77,7 +77,8 @@ const getTermOptions = (props: TermProps): ITerminalOptions => {
brightMagenta: props.colors.lightMagenta, brightMagenta: props.colors.lightMagenta,
brightCyan: props.colors.lightCyan, brightCyan: props.colors.lightCyan,
brightWhite: props.colors.lightWhite brightWhite: props.colors.lightWhite
} },
screenReaderMode: props.screenReaderMode
}; };
}; };

View file

@ -116,6 +116,7 @@ export default class Terms extends React.Component<TermsProps> {
webLinksActivationKey: this.props.webLinksActivationKey, webLinksActivationKey: this.props.webLinksActivationKey,
macOptionSelectionMode: this.props.macOptionSelectionMode, macOptionSelectionMode: this.props.macOptionSelectionMode,
disableLigatures: this.props.disableLigatures, disableLigatures: this.props.disableLigatures,
screenReaderMode: this.props.screenReaderMode,
parentProps: this.props parentProps: this.props
}); });

1
lib/config.d.ts vendored
View file

@ -51,6 +51,7 @@ export type configOptions = {
}; };
padding: string; padding: string;
quickEdit: boolean; quickEdit: boolean;
screenReaderMode: boolean;
scrollback: number; scrollback: number;
selectionColor: string; selectionColor: string;
shell: string; shell: string;

View file

@ -45,7 +45,8 @@ const mapStateToProps = (state: HyperState) => {
webGLRenderer: state.ui.webGLRenderer, webGLRenderer: state.ui.webGLRenderer,
webLinksActivationKey: state.ui.webLinksActivationKey, webLinksActivationKey: state.ui.webLinksActivationKey,
macOptionSelectionMode: state.ui.macOptionSelectionMode, macOptionSelectionMode: state.ui.macOptionSelectionMode,
disableLigatures: state.ui.disableLigatures disableLigatures: state.ui.disableLigatures,
screenReaderMode: state.ui.screenReaderMode
}; };
}; };

3
lib/hyper.d.ts vendored
View file

@ -79,6 +79,7 @@ export type uiState = Immutable<{
quickEdit: boolean; quickEdit: boolean;
resizeAt: number; resizeAt: number;
rows: number | null; rows: number | null;
screenReaderMode: boolean;
scrollback: number; scrollback: number;
selectionColor: string; selectionColor: string;
showHamburgerMenu: boolean | ''; showHamburgerMenu: boolean | '';
@ -287,6 +288,7 @@ export type TermGroupOwnProps = {
| 'onTitle' | 'onTitle'
| 'padding' | 'padding'
| 'quickEdit' | 'quickEdit'
| 'screenReaderMode'
| 'scrollback' | 'scrollback'
| 'selectionColor' | 'selectionColor'
| 'sessions' | 'sessions'
@ -344,6 +346,7 @@ export type TermProps = {
padding: string; padding: string;
quickEdit: boolean; quickEdit: boolean;
rows: number | null; rows: number | null;
screenReaderMode: boolean;
scrollback: number; scrollback: number;
search: boolean; search: boolean;
searchAddon: SearchAddon | null; searchAddon: SearchAddon | null;

View file

@ -107,7 +107,8 @@ const initial: uiState = Immutable<Mutable<uiState>>({
webGLRenderer: true, webGLRenderer: true,
webLinksActivationKey: '', webLinksActivationKey: '',
macOptionSelectionMode: 'vertical', macOptionSelectionMode: 'vertical',
disableLigatures: true disableLigatures: true,
screenReaderMode: false
}); });
const reducer: IUiReducer = (state = initial, action) => { const reducer: IUiReducer = (state = initial, action) => {
@ -264,6 +265,10 @@ const reducer: IUiReducer = (state = initial, action) => {
ret.disableLigatures = config.disableLigatures; ret.disableLigatures = config.disableLigatures;
} }
if (config.screenReaderMode !== undefined) {
ret.screenReaderMode = config.screenReaderMode;
}
ret._lastUpdate = now; ret._lastUpdate = now;
return ret; return ret;