Skip to content

Commit

Permalink
add an aria label prop to the cypher editor
Browse files Browse the repository at this point in the history
  • Loading branch information
daveajrussell committed May 22, 2024
1 parent 8a63a35 commit 64a0833
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react-codemirror-playground/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export function App() {
theme={darkMode ? 'dark' : 'light'}
history={Object.values(demos)}
schema={schema}
ariaLabel="Cypher Editor"
/>

{commandRanCount > 0 && (
Expand Down
11 changes: 11 additions & 0 deletions packages/react-codemirror/src/CypherEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ export interface CypherEditorProps {
* @default false
*/
readonly?: boolean;

/**
* String value to assign to the aria-label attribute of the editor
*
*/
ariaLabel?: string;
}

const executeKeybinding = (onExecute?: (cmd: string) => void) =>
Expand Down Expand Up @@ -311,6 +317,11 @@ export class CypherEditor extends Component<
? EditorView.domEventHandlers(this.props.domEventHandlers)
: [],
),
this.props.ariaLabel
? EditorView.contentAttributes.of({
'aria-label': this.props.ariaLabel,
})
: [],
],
doc: this.props.value,
});
Expand Down

0 comments on commit 64a0833

Please sign in to comment.