element rendered by Link does not generate display box due to `display: contents` style */}
+ {/* Thus ref is passed to MenuItem instead of Link */}
+
+
+ );
+});
MenuLinkItem.displayName = 'MenuLinkItem';
diff --git a/packages/component/src/components/app-sidebar/quick-search-input/index.css.ts b/packages/component/src/components/app-sidebar/quick-search-input/index.css.ts
index 7033cadd89..d748ab9dbf 100644
--- a/packages/component/src/components/app-sidebar/quick-search-input/index.css.ts
+++ b/packages/component/src/components/app-sidebar/quick-search-input/index.css.ts
@@ -12,7 +12,7 @@ export const root = style({
userSelect: 'none',
cursor: 'pointer',
padding: '0 12px',
- margin: '12px 0',
+ margin: '20px 0',
position: 'relative',
});
diff --git a/packages/component/src/components/app-sidebar/resize-indicator/index.tsx b/packages/component/src/components/app-sidebar/resize-indicator/index.tsx
index 2e6f0d9548..666b49ba36 100644
--- a/packages/component/src/components/app-sidebar/resize-indicator/index.tsx
+++ b/packages/component/src/components/app-sidebar/resize-indicator/index.tsx
@@ -1,6 +1,7 @@
+import { assertExists } from '@blocksuite/global/utils';
import { useAtom, useSetAtom } from 'jotai';
import type { ReactElement } from 'react';
-import { useCallback, useLayoutEffect, useState } from 'react';
+import { useCallback } from 'react';
import {
appSidebarOpenAtom,
@@ -18,16 +19,10 @@ export const ResizeIndicator = (props: ResizeIndicatorProps): ReactElement => {
const [sidebarOpen, setSidebarOpen] = useAtom(appSidebarOpenAtom);
const [isResizing, setIsResizing] = useAtom(appSidebarResizingAtom);
- const [anchorLeft, setAnchorLeft] = useState(0);
-
- useLayoutEffect(() => {
- if (!props.targetElement) return;
- const { left } = props.targetElement.getBoundingClientRect();
- setAnchorLeft(left);
- }, [props.targetElement]);
-
const onResizeStart = useCallback(() => {
let resized = false;
+ assertExists(props.targetElement);
+ const { left: anchorLeft } = props.targetElement.getBoundingClientRect();
function onMouseMove(e: MouseEvent) {
e.preventDefault();
@@ -51,13 +46,7 @@ export const ResizeIndicator = (props: ResizeIndicatorProps): ReactElement => {
},
{ once: true }
);
- }, [
- anchorLeft,
- props.targetElement,
- setIsResizing,
- setSidebarOpen,
- setWidth,
- ]);
+ }, [props.targetElement, setIsResizing, setSidebarOpen, setWidth]);
return (
{
await first.getByTestId('fav-collapsed-button').click();
const collectionPage = collections.getByTestId('collection-page').nth(0);
expect(await collectionPage.textContent()).toBe('test page');
+ await collectionPage.hover();
await collectionPage.getByTestId('collection-page-options').click();
const deletePage = page
.getByTestId('collection-page-option')
.getByText('Delete');
await deletePage.click();
expect(await collections.getByTestId('collection-page').count()).toBe(0);
+ await first.hover();
await first.getByTestId('collection-options').click();
const deleteCollection = page
.getByTestId('collection-option')
@@ -76,6 +78,7 @@ test('pin and unpin collection', async ({ page }) => {
await page.waitForTimeout(50);
expect(await items.count()).toBe(1);
const first = items.first();
+ await first.hover();
await first.getByTestId('collection-options').click();
const deleteCollection = page
.getByTestId('collection-option')
@@ -99,6 +102,7 @@ test('edit collection', async ({ page }) => {
const items = collections.getByTestId('collection-item');
expect(await items.count()).toBe(1);
const first = items.first();
+ await first.hover();
await first.getByTestId('collection-options').click();
const editCollection = page
.getByTestId('collection-option')
@@ -117,6 +121,7 @@ test('edit collection and change filter date', async ({ page }) => {
const items = collections.getByTestId('collection-item');
expect(await items.count()).toBe(1);
const first = items.first();
+ await first.hover();
await first.getByTestId('collection-options').click();
const editCollection = page
.getByTestId('collection-option')
diff --git a/tests/affine-local/e2e/local-first-favorites-items.spec.ts b/tests/affine-local/e2e/local-first-favorites-items.spec.ts
index e2bd320927..d672fb9af1 100644
--- a/tests/affine-local/e2e/local-first-favorites-items.spec.ts
+++ b/tests/affine-local/e2e/local-first-favorites-items.spec.ts
@@ -122,7 +122,7 @@ test("Deleted page's reference will not be shown in sidebar", async ({
'[data-testid="fav-collapsed-button"]'
);
- await expect(collapseButton).not.toBeVisible();
+ expect(collapseButton).toHaveAttribute('data-disabled', 'true');
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');