Skip to content

Commit

Permalink
[FIX] BottomBarSheet: renaming a sheet with styled content
Browse files Browse the repository at this point in the history
Modified the span element to be contenteditable in plain-text only,
resolving the traceback issue during sheet renaming.

Task:: 3621086

closes #3543

X-original-commit: 2fc6313
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Dhrutik Patel (dhrp) <dhrp@odoo.com>
  • Loading branch information
dhrp-odoo committed Jan 29, 2024
1 parent c96021f commit 53456ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/bottom_bar_sheet/bottom_bar_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
t-on-dblclick="() => this.onDblClick()"
t-on-focusout="() => this.onFocusOut()"
t-on-keydown="(ev) => this.onKeyDown(ev)"
t-att-contenteditable="state.isEditing.toString()"
t-att-contenteditable="state.isEditing ? 'plaintext-only': 'false'"
/>
<span class="o-sheet-icon ms-1" t-on-click.stop="(ev) => this.onIconClick(ev)">
<t t-call="o-spreadsheet-Icon.TRIANGLE_DOWN"/>
Expand Down
4 changes: 2 additions & 2 deletions tests/bottom_bar/bottom_bar_component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ describe("BottomBar component", () => {
const sheetName = fixture.querySelector<HTMLElement>(".o-sheet-name")!;
expect(sheetName.getAttribute("contenteditable")).toEqual("false");
await doubleClick(sheetName);
expect(sheetName.getAttribute("contenteditable")).toEqual("true");
expect(sheetName.getAttribute("contenteditable")).toEqual("plaintext-only");
expect(document.activeElement).toEqual(sheetName);
});

Expand All @@ -261,7 +261,7 @@ describe("BottomBar component", () => {
await nextTick();
await click(fixture, ".o-menu-item[data-name='rename'");
const sheetName = fixture.querySelector<HTMLElement>(".o-sheet-name")!;
expect(sheetName.getAttribute("contenteditable")).toEqual("true");
expect(sheetName.getAttribute("contenteditable")).toEqual("plaintext-only");
expect(document.activeElement).toEqual(sheetName);
});

Expand Down

0 comments on commit 53456ad

Please sign in to comment.