Compare commits

..

1 Commits

Author SHA1 Message Date
Ashwin Bhatkal
426b1cbc7a fix: turn off the editor find panel in the list filter bar 2026-11-18 18:13:48 +05:30
2 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { EditorView } from '@uiw/react-codemirror';
import { DASHBOARDS_DSL_GRAMMAR } from 'pages/DashboardsListPage/list.config';
import { render, screen, userEvent } from 'tests/test-utils';
import SearchBar from '../SearchBar';
const TEST_ID = 'list-search';
function getView(): EditorView {
const view = EditorView.findFromDOM(screen.getByTestId(TEST_ID));
if (!view) {
throw new Error('Search editor not found');
}
return view;
}
describe('SearchBar', () => {
it('leaves Mod-f to the browser instead of opening the editor find panel', async () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
render(
<SearchBar
value="name = 'api'"
grammar={DASHBOARDS_DSL_GRAMMAR}
testIdPrefix={TEST_ID}
onChange={jest.fn()}
onSubmit={jest.fn()}
/>,
);
const view = getView();
await user.click(view.contentDOM);
await user.keyboard('{Control>}f{/Control}');
expect(view.dom.querySelector('.cm-search')).toBeNull();
});
});

View File

@@ -35,6 +35,9 @@ export const BASIC_SETUP = {
bracketMatching: false,
closeBrackets: false,
autocompletion: false,
// Its find panel is dropped by every reconfigure @uiw/react-codemirror runs on
// re-render, and the focused panel input then dispatches mid-update and throws.
searchKeymap: false,
// Use the browser's native caret so it blinks (a CM-drawn cursor needs extra
// styling and doesn't blink by default).
drawSelection: false,