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


##########
superset-frontend/packages/superset-ui-core/src/components/UnsavedChangesModal/UnsavedChangesModal.test.tsx:
##########
@@ -94,3 +95,39 @@ test('should only call handleSave when clicking the Save 
button', async () => {
   expect(mockOnHide).not.toHaveBeenCalled();
   expect(mockOnConfirmNavigation).not.toHaveBeenCalled();
 });
+
+test('renders above an already-open modal without a hardcoded z-index', () => {
+  // Regression test for a bug where this modal could render BEHIND another
+  // already-open modal (e.g. a draggable "View query" modal), because its
+  // z-index was pinned to a hardcoded constant instead of relying on Ant
+  // Design's automatic z-index stacking. Since this modal is always opened
+  // on top of whatever it's interrupting, it should always come out ahead
+  // with no manual override at all.
+  render(
+    <>
+      <Modal show title="Other open modal" onHide={() => {}}>
+        <div>Other modal content</div>
+      </Modal>
+      <UnsavedChangesModal
+        showModal
+        onHide={() => {}}
+        handleSave={() => {}}
+        onConfirmNavigation={() => {}}
+      />
+    </>,
+  );
+
+  const otherDialog = screen.getByRole('dialog', {
+    name: /other open modal/i,
+  });
+  const unsavedChangesDialog = screen.getByRole('dialog', {
+    name: /unsaved changes/i,
+  });
+
+  const otherZIndex = Number(getComputedStyle(otherDialog).zIndex);
+  const unsavedChangesZIndex = Number(
+    getComputedStyle(unsavedChangesDialog).zIndex,
+  );

Review Comment:
   **Suggestion:** The z-index is applied by Ant Design to the modal wrapper, 
while the role-bearing `.ant-modal` element does not receive that value. 
Reading `getComputedStyle` from these dialog elements therefore returns an 
empty z-index in jsdom, which `Number` converts to `0` for both dialogs and 
causes this regression test to fail or measure the wrong stacking layer. 
Inspect the nearest modal wrapper instead. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Regression test can fail in CI despite correct modal stacking.
   - ⚠️ Assertion measures inner dialogs, not stacking wrappers.
   - ⚠️ Z-index regression coverage becomes unreliable.
   ```
   </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=43cdcae1cedf44aca6eb7fbec094e9b8&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=43cdcae1cedf44aca6eb7fbec094e9b8&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/packages/superset-ui-core/src/components/UnsavedChangesModal/UnsavedChangesModal.test.tsx
   **Line:** 127:130
   **Comment:**
        *Logic Error: The z-index is applied by Ant Design to the modal 
wrapper, while the role-bearing `.ant-modal` element does not receive that 
value. Reading `getComputedStyle` from these dialog elements therefore returns 
an empty z-index in jsdom, which `Number` converts to `0` for both dialogs and 
causes this regression test to fail or measure the wrong stacking layer. 
Inspect the nearest modal wrapper instead.
   
   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%2F42548&comment_hash=a052b3dc112a605b2f71477b462eb9e8673da9f71bf3332c9ee0c933ffb75f06&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42548&comment_hash=a052b3dc112a605b2f71477b462eb9e8673da9f71bf3332c9ee0c933ffb75f06&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