Skip to content

Commit 829c816

Browse files
Anemymcasimir
authored andcommitted
chore(query-bar): revert tab behavior in editor (#3727)
1 parent 1860d67 commit 829c816

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

packages/compass-query-bar/src/components/option-editor.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ const editorWithErrorStyles = css({
3939
},
4040
});
4141

42-
function disableEditorCommand(editor: AceEditor, name: string) {
43-
const command = editor.commands.byName[name];
44-
command.bindKey = undefined;
45-
editor.commands.addCommand(command);
46-
}
47-
4842
type OptionEditorProps = {
4943
hasError: boolean;
5044
id: string;
@@ -135,13 +129,6 @@ export const OptionEditor: React.FunctionComponent<OptionEditorProps> = ({
135129
const onLoadEditor = useCallback((editor: AceEditor) => {
136130
editorRef.current = editor;
137131
editorRef.current.setBehavioursEnabled(true);
138-
139-
// Disable the default tab key handlers. COMPASS-4900
140-
// This for accessibility so that users can tab navigate through Compass.
141-
// Down the line if folks want tab functionality we can keep
142-
// these commands enabled and disable them with the `Escape` key.
143-
disableEditorCommand(editor, 'indent');
144-
disableEditorCommand(editor, 'outdent');
145132
}, []);
146133

147134
return (

packages/compass-query-bar/src/components/query-bar.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ describe('QueryBar Component', function () {
306306
renderQueryBar();
307307
});
308308

309-
it('should allow tabbing through the input to the apply button COMPASS-4900', function () {
309+
it('should not allow tabbing through the input to the apply button', function () {
310310
const queryHistoryButton = screen.getByTestId(queryHistoryButtonId);
311311
const applyButton = screen.getByTestId('query-bar-apply-filter-button');
312312

@@ -315,9 +315,9 @@ describe('QueryBar Component', function () {
315315
userEvent.tab();
316316
userEvent.tab();
317317

318-
expect(applyButton.ownerDocument.activeElement === applyButton).to.equal(
319-
true
320-
);
318+
expect(
319+
applyButton.ownerDocument.activeElement === screen.getByRole('textbox')
320+
).to.equal(true);
321321
});
322322
});
323323
});

0 commit comments

Comments
 (0)