Skip to content

Fix iframe interference during resize by disabling pointer events - #653

Merged
cezudas merged 1 commit into
mainfrom
cezudas/OPS-1823
May 21, 2025
Merged

Fix iframe interference during resize by disabling pointer events#653
cezudas merged 1 commit into
mainfrom
cezudas/OPS-1823

Conversation

@cezudas

@cezudas cezudas commented May 20, 2025

Copy link
Copy Markdown
Contributor

Fixes OPS-1823.

I've triggered a deployment on UX env, it can be used for a quick test.

Demo using UX env: https://www.loom.com/share/49050daf55be4772ae2bc89b0a3ed45b

@linear

linear Bot commented May 20, 2025

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@cezudas
cezudas marked this pull request as ready for review May 20, 2025 20:02
Copilot AI review requested due to automatic review settings May 20, 2025 20:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes OPS-1823 by temporarily disabling pointer events on iframes during a resize interaction to prevent them from intercepting mouse events.

  • Add toggleIframePointerEvents to disable/enable pointer events on all iframes.
  • Invoke the toggle in startResize, handleMouseUp, and in the hook cleanup.
  • Self-close the <ResizeIcon> and assign ResizableArea.displayName.
Comments suppressed due to low confidence (1)

packages/ui-components/src/components/resizable-area/resizable-area.tsx:62

  • There are currently no tests for the iframe pointer-events toggle behavior. Consider adding unit or integration tests to verify that pointer events are correctly disabled and re-enabled during resize.
const toggleIframePointerEvents = (enabled: boolean) => {

const startPosRef = useRef({ x: 0, y: 0, width: 0, height: 0 });

const toggleIframePointerEvents = (enabled: boolean) => {
const iframes = document.querySelectorAll('iframe');

This comment was marked as off-topic.

return () => {
document.removeEventListener('mousemove', handleMouseMove);
document.removeEventListener('mouseup', handleMouseUp);
toggleIframePointerEvents(true);

Copilot AI May 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This cleanup always re-enables pointer events even if no resize was active. You may want to guard this call with isResizingRef.current or track the toggle state to avoid restoring pointer events inaccurately.

Suggested change
toggleIframePointerEvents(true);
if (isResizingRef.current) {
toggleIframePointerEvents(true);
}

Copilot uses AI. Check for mistakes.
@@ -59,6 +59,13 @@ export function ResizableArea({
const isResizingRef = useRef(false);
const startPosRef = useRef({ x: 0, y: 0, width: 0, height: 0 });

This comment was marked as off-topic.

@cezudas
cezudas merged commit 74211e0 into main May 21, 2025
@cezudas
cezudas deleted the cezudas/OPS-1823 branch May 21, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants