Skip to content

Commit d97fb64

Browse files
authored
Merge pull request #1277 from mito-ds/double-click-bug
Fix bug when double-clicking cell while cell editor is open
2 parents 8b8be75 + 29ebf05 commit d97fb64

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

mitosheet/src/mito/components/endo/EndoGrid.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,9 @@ function EndoGrid(props: {
544544

545545
// On double click, open the cell editor on this cell
546546
const onDoubleClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
547+
if (editorState !== undefined) {
548+
return;
549+
}
547550
const {rowIndex, columnIndex} = getIndexesFromMouseEvent(e);
548551
// Don't open for headers
549552
if ((rowIndex === undefined || columnIndex === undefined) || getIsHeader(rowIndex, columnIndex)) {

tests/streamlit_ui_tests/grid/set_column_formula_tests.spec.ts

+15
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,21 @@ test('Reference cell in previous row by clicking on it', async ({ page }) => {
143143
expect(cellValues).toEqual(['0', '1', '4', '7']);
144144
});
145145

146+
test('Double clicking on cell while cell editor is open does not close cell editor', async ({ page }) => {
147+
const columnHeader = 'Column4';
148+
149+
const mito = await getMitoFrameWithTestCSV(page);
150+
await createNewColumn(page, mito, 3, columnHeader);
151+
152+
const cell = await getCellAtRowIndexAndColumnName(mito, 0, columnHeader);
153+
await cell.dblclick();
154+
await mito.getByRole('textbox').fill('=');
155+
156+
const otherCell = await getCellAtRowIndexAndColumnName(mito, 0, 'Column1');
157+
await otherCell.dblclick();
158+
await expect(mito.locator('#cell-editor-input')).toHaveValue('=Column10');
159+
});
160+
146161
test('Use arrow keys to select cell', async ({ page }) => {
147162
const columnHeader = 'Column4';
148163

0 commit comments

Comments
 (0)