codeant-ai-for-open-source[bot] commented on code in PR #42614:
URL: https://github.com/apache/superset/pull/42614#discussion_r3682757205


##########
superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.tsx:
##########
@@ -1010,6 +1072,29 @@ function AnnotationLayer({
     theme,
   ]);
 
+  const sliceConfiguration = renderSliceConfiguration();
+  const hasSliceConfiguration = !!sliceConfiguration;
+
+  useLayoutEffect(() => {
+    const row = sectionsRef.current;
+    const popover = row?.closest('.ant-popover');
+    const panel = document.getElementById(CONTROL_SECTIONS_ID);
+    if (!row || !popover || !panel) {
+      return;
+    }
+    // Padding and border the popover adds around the row.
+    const popoverInsetWidth =
+      popover.getBoundingClientRect().width - 
row.getBoundingClientRect().width;
+    const available =
+      document.documentElement.clientWidth -
+      panel.getBoundingClientRect().right -
+      popoverInsetWidth -
+      VIEWPORT_INSET;
+    if (available > 0) {
+      setSectionsMaxWidth(available);
+    }
+  }, [hasSliceConfiguration]);

Review Comment:
   **Suggestion:** The calculated pixel width is cached and recalculated only 
when `hasSliceConfiguration` changes. If the viewport or control-panel position 
changes while this component remains mounted, the stale `sectionsMaxWidth` 
continues to constrain or enlarge the row, allowing the popover to overflow 
again on a narrower viewport. Recalculate on resize and relevant layout 
changes, or observe the panel/popover with a resize observer. [css layout issue]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Narrow resized viewports can hide display configuration.
   - ❌ Apply and OK actions can become unreachable.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=47663cc11fcf47ef815f0b03372650bf&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=47663cc11fcf47ef815f0b03372650bf&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.tsx
   **Line:** 1078:1096
   **Comment:**
        *Css Layout Issue: The calculated pixel width is cached and 
recalculated only when `hasSliceConfiguration` changes. If the viewport or 
control-panel position changes while this component remains mounted, the stale 
`sectionsMaxWidth` continues to constrain or enlarge the row, allowing the 
popover to overflow again on a narrower viewport. Recalculate on resize and 
relevant layout changes, or observe the panel/popover with a resize observer.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42614&comment_hash=0bd785ae6ef83d570e152e8fd8339ff2098dd6836846c188bdfc63f7ed38a11c&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42614&comment_hash=0bd785ae6ef83d570e152e8fd8339ff2098dd6836846c188bdfc63f7ed38a11c&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to