Skip to content

Commit d4b38dc

Browse files
committed
[FIX] Composer: Fix assistant position
The composer assistant position was updated with the introduction of the mobile mode but there are two issues with it: - the change of CSS rule did not account for cells with the content set on multiple lines - the structure of the bottom bar composer (in mobile mode) still hides the formula assistant This revision reverts the assistant position and simply hides it in mobile. A future work will try to reintroduce it with a modified aspect that suits the mobile interface. closes #7537 Task: 5155838 X-original-commit: de23932 Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
1 parent f5bdbcc commit d4b38dc

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/components/composer/composer/composer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ export class Composer extends Component<CellComposerProps, SpreadsheetChildEnv>
237237
assistantStyle["max-height"] = `${availableSpaceAbove - CLOSE_ICON_RADIUS}px`;
238238
// render top
239239
// We compensate 2 px of margin on the assistant style + 1px for design reasons
240-
assistantStyle.transform = `translate(0, calc(-100% - ${cellHeight + 3}px))`;
240+
assistantStyle.top = `-3px`;
241+
assistantStyle.transform = `translate(0, -100%)`;
241242
}
242243
if (cellX + ASSISTANT_WIDTH > this.props.delimitation.width) {
243244
// render left

src/components/small_bottom_bar/small_bottom_bar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { CellComposerStore } from "../composer/composer/cell_composer_store";
88
import { CellComposerProps, Composer } from "../composer/composer/composer";
99
import { ComposerFocusStore, ComposerInterface } from "../composer/composer_focus_store";
1010
import { css, cssPropertiesToCss } from "../helpers";
11-
import { getBoundingRectAsPOJO, isIOS } from "../helpers/dom_helpers";
11+
import { getBoundingRectAsPOJO } from "../helpers/dom_helpers";
1212
import { RibbonMenu } from "./ribbon_menu/ribbon_menu";
1313

1414
interface Props {
@@ -106,7 +106,7 @@ export class SmallBottomBar extends Component<Props, SpreadsheetChildEnv> {
106106
height: this.focus === "inactive" ? "26px" : "fit-content",
107107
"max-height": `130px`,
108108
}),
109-
showAssistant: !isIOS(), // Hide assistant on iOS as it breaks visually
109+
showAssistant: false, // Hide assistant in small composer as it gets cropped ATM
110110
placeholder: this.composerStore.placeholder,
111111
};
112112
}

tests/composer/autocomplete_dropdown_component.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,9 @@ describe("composer Assistant", () => {
597597
expect(assistantEL).toMatchSnapshot();
598598
expect(assistantEL.style.width).toBe("300px");
599599
const containerEL = fixture.querySelector<HTMLElement>(".o-composer-assistant-container")!;
600-
const marginsOffset = rect.height + 3; // 3px for the border and margin
601-
expect(containerEL.style.transform).toBe(`translate(0, calc(-100% - ${marginsOffset}px))`);
600+
601+
expect(containerEL.style.top).toBe(`-3px`); // 3px for the border and margin
602+
expect(containerEL.style.transform).toBe(`translate(0, -100%)`);
602603
});
603604

604605
test("composer assistant min-width is the same as the underlying cell", async () => {

0 commit comments

Comments
 (0)