fix: auto show and hide editor action bar

This commit is contained in:
David Nguyen
2026-09-26 16:33:03 +10:00
parent 30a0979573
commit 941f4a1e4c
10 changed files with 68 additions and 33 deletions
@@ -49,10 +49,7 @@ test('a selected field survives zooming', async ({ page }) => {
await root.getByRole('button', { name: 'Signature', exact: true }).click();
await getPageCanvas(root).click({ position: { x: 160, y: 160 } });
// A freshly placed field is auto selected, which deliberately suppresses
// the action bar, so click it to make it a real selection.
await selectContentOnCanvas(root, { x: 160, y: 160 });
// A freshly placed field is selected, with its action bar showing.
await expect.poll(() => getKonvaTransformerNodeCountForPage(root, 1)).toBe(1);
await expect(root.getByTestId('envelope-canvas-action-bar')).toBeVisible();
@@ -69,6 +69,17 @@ type EnvelopeEditorProviderValue = {
selectedEditorTab: EnvelopeEditorTab;
setSelectedEditorTab: (tab: EnvelopeEditorTab) => void;
/**
* Whether a field or content has been picked from the palette and is
* waiting to be placed on the page.
*
* The canvas drops its selection while this is set, so nothing floating
* over the page (the transformer, the action bar) sits under the
* placement click.
*/
isPlacingItem: boolean;
setIsPlacingItem: (isPlacingItem: boolean) => void;
isAutosaving: boolean;
flushAutosave: () => Promise<TEditorEnvelope>;
autosaveError: boolean;
@@ -159,6 +170,8 @@ export const EnvelopeEditorProvider = ({
const [selectedEditorTab, setSelectedEditorTab] = useState<EnvelopeEditorTab>('fields');
const [isPlacingItem, setIsPlacingItem] = useState(false);
const isCscMode = IS_INSTANCE_CSC_MODE();
/**
@@ -655,6 +668,8 @@ export const EnvelopeEditorProvider = ({
editorRecipients,
selectedEditorTab,
setSelectedEditorTab,
isPlacingItem,
setIsPlacingItem,
autosaveError,
flushAutosave,
isAutosaving,