codeant-ai-for-open-source[bot] commented on code in PR #43333:
URL: https://github.com/apache/superset/pull/43333#discussion_r3812279117
##########
superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx:
##########
@@ -270,6 +270,11 @@ const CustomModal = ({
const draggableRef = useRef<HTMLDivElement>(null);
const [bounds, setBounds] = useState<DraggableBounds>({});
const [dragDisabled, setDragDisabled] = useState<boolean>(true);
+ // Controlled position for react-draggable. Keeping Draggable in controlled
+ // mode lets us sync position with re-resizable's onResize so that resizing
+ // from top/left edges correctly repositions the modal (anchoring the
+ // opposite corner) instead of fighting over position.
+ const [position, setPosition] = useState({ x: 0, y: 0 });
Review Comment:
**Suggestion:** The controlled position is initialized only once and is
never reset when the modal closes or reopens. With Ant Design retaining the
`CustomModal` component, a modal reopened after being dragged retains its
previous translation, unlike the prior unmounted draggable state, and can
reopen displaced or outside the viewport. Reset the position when `show`
transitions to false or when a new modal opening begins. [stale reference]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Reopened View as table modals retain stale screen offsets.
- ❌ Dragged chart modals can reopen partly outside the viewport.
- ⚠️ Users must manually reposition displaced modal dialogs.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
<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/Modal/Modal.tsx
**Line:** 277:277
**Comment:**
*Stale Reference: The controlled position is initialized only once and
is never reset when the modal closes or reopens. With Ant Design retaining the
`CustomModal` component, a modal reopened after being dragged retains its
previous translation, unlike the prior unmounted draggable state, and can
reopen displaced or outside the viewport. Reset the position when `show`
transitions to false or when a new modal opening begins.
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%2F43333&comment_hash=4ada7fa8e2d7792d395545aae96f4dbb680f8f3e7605333c5e66806d8c4b2bf9&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43333&comment_hash=4ada7fa8e2d7792d395545aae96f4dbb680f8f3e7605333c5e66806d8c4b2bf9&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]