Skip to content

Commit

Permalink
[FIX] GridComposer: Fix CellReference pill display
Browse files Browse the repository at this point in the history
How to reproduce:
- Select a large zone (more than 1 cell) on the grid
- Hit enter to start the edition

=> the cell reference pill is visible even though it functionally should
only be visible if we scrolled (changed sheet) while editing.

closes #5502

Task: 4501136
X-original-commit: 2754a7c
Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
Signed-off-by: Rémi Rahir (rar) <[email protected]>
  • Loading branch information
rrahir committed Jan 21, 2025
1 parent 63f3421 commit 96b3e26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/composer/grid_composer/grid_composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class GridComposer extends Component<Props, SpreadsheetChildEnv> {
return;
}
const sheetId = this.env.model.getters.getActiveSheetId();
const zone = this.env.model.getters.getSelectedZone();
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
const rect = this.env.model.getters.getVisibleRect(zone);
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
this.isCellReferenceVisible = true;
Expand Down
2 changes: 2 additions & 0 deletions tests/composer/composer_integration_component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
resizeRows,
selectCell,
setCellContent,
setSelection,
setStyle,
} from "../test_helpers/commands_helpers";
import {
Expand Down Expand Up @@ -248,6 +249,7 @@ describe("Composer interactions", () => {
});

test("Starting the edition should not display the cell reference", async () => {
setSelection(model, ["A1:A2"]);
await startComposition();
expect(fixture.querySelector(".o-grid div.o-cell-reference")).toBeNull();
});
Expand Down

0 comments on commit 96b3e26

Please sign in to comment.