diff --git a/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts b/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts index fb05b24c3..bc2537b95 100644 --- a/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts +++ b/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts @@ -258,10 +258,7 @@ export class PeekViewEntity extends Entity { this._active$.next({ target, info: resolvedInfo }); this._show$.next({ value: true, - animation: - resolvedInfo.type === 'doc' || resolvedInfo.type === 'ai-chat-block' - ? 'zoom' - : 'fade', + animation: target.element ? 'zoom' : 'fade', }); if (abortSignal) { diff --git a/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx b/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx index 89eea67b3..0ae0fc1b6 100644 --- a/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx +++ b/packages/frontend/core/src/modules/peek-view/view/modal-container.tsx @@ -128,6 +128,23 @@ export const PeekViewModalContainer = forwardRef< const targets = contentClip; const lockSizeEl = content; + // if target has no bounding client rect, find its parent that has bounding client rect + let iteration = 0; + while ( + target && + !target.getBoundingClientRect().width && + iteration < 10 + ) { + // eslint-disable-next-line react-hooks/exhaustive-deps + target = target.parentElement || undefined; + iteration++; + } + + if (!target) { + resolve(); + return; + } + const from = zoomIn ? target : contentClip; const to = zoomIn ? contentClip : target;