Skip to content

feature: allow modal to be resized in width #2838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: alpha
Choose a base branch
from

Conversation

dblythy
Copy link
Member

@dblythy dblythy commented Jun 1, 2025

New Pull Request Checklist

Issue Description

Closes: #1879

Approach

TODOs before merging

  • Add tests
  • Add changes to documentation (guides, repository pages, in-code descriptions)

Summary by CodeRabbit

  • New Features

    • The modal window can now be dynamically resized in width by dragging new resize handles on its left and right edges.
  • Style

    • Added visual styling for the resize handles and improved modal transition handling during resizing.

Copy link

parse-github-assistant bot commented Jun 1, 2025

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Copy link

coderabbitai bot commented Jun 1, 2025

📝 Walkthrough

"""

Walkthrough

The Modal component was updated to allow users to dynamically resize its width using a new resize handle. The width prop was renamed to initialWidth, internal state was added to track resizing, and mouse event handlers were implemented. Corresponding CSS was introduced for the resize handle and to disable transitions during resizing.

Changes

File(s) Change Summary
src/components/Modal/Modal.react.js Refactored Modal to support width resizing: renamed prop, added state/refs, implemented mouse event handlers.
src/components/Modal/Modal.scss Added styles for the resize handle and a class to disable CSS transitions during resizing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ModalComponent
    participant Window

    User->>ModalComponent: MouseDown on resize handle
    ModalComponent->>Window: Attach MouseMove and MouseUp listeners

    User->>Window: MouseMove (dragging)
    Window->>ModalComponent: handleMouseMove (update width)

    User->>Window: MouseUp
    Window->>ModalComponent: handleMouseUp (end resizing)
    ModalComponent->>Window: Remove MouseMove and MouseUp listeners
Loading

Assessment against linked issues

Objective Addressed Explanation
Allow config parameter dialog/modal to be resized in width (#1879)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found.
"""

Suggested reviewers

  • mtrezza

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error code ERR_SSL_WRONG_VERSION_NUMBER
npm error errno ERR_SSL_WRONG_VERSION_NUMBER
npm error request to https://10.0.0.28:4873/npm/-/npm-10.9.2.tgz failed, reason: C0FC7F5A3E7F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
npm error
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-05T11_37_26_881Z-debug-0.log


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Jun 1, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (2)
src/components/Modal/Modal.scss (1)

103-112: Consider enhancing the resize handle's visual feedback.

The resize handle might not be immediately discoverable to users. Consider adding hover states and a more visible indicator.

 .resizeHandle {
   width: 16px;
   height: 16px;
   position: absolute;
   bottom: 0;
   right: 0;
   cursor: se-resize;
-  background: rgba(255, 255, 255, 0.5);
+  background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.2) 50%);
   z-index: 10;
+  transition: background 0.2s ease;
+  
+  &:hover {
+    background: linear-gradient(135deg, transparent 40%, rgba(0, 0, 0, 0.3) 40%);
+  }
 }
src/components/Modal/Modal.react.js (1)

62-72: Optimize event listener attachment for better performance.

The mouse move event listener is always active even when not resizing, which could impact performance.

Only attach the mousemove listener when resizing starts:

 const handleMouseDown = (e) => {
   e.preventDefault();
   resizing.current = true;
   if (modalRef.current) {
     modalRef.current.classList.add(styles.noTransition);
   }
+  document.addEventListener('mousemove', handleMouseMove);
+  document.addEventListener('mouseup', handleMouseUp);
 };

 const handleMouseUp = () => {
   resizing.current = false;
   if (modalRef.current) {
     modalRef.current.classList.remove(styles.noTransition);
   }
+  document.removeEventListener('mousemove', handleMouseMove);
+  document.removeEventListener('mouseup', handleMouseUp);
 };

-useEffect(() => {
-  document.addEventListener('mousemove', handleMouseMove);
-  document.addEventListener('mouseup', handleMouseUp);
-
-  return () => {
-    document.removeEventListener('mousemove', handleMouseMove);
-    document.removeEventListener('mouseup', handleMouseUp);
-  };
-}, []);
+useEffect(() => {
+  return () => {
+    // Cleanup on unmount
+    document.removeEventListener('mousemove', handleMouseMove);
+    document.removeEventListener('mouseup', handleMouseUp);
+  };
+}, [handleMouseMove, handleMouseUp]);
🧰 Tools
🪛 GitHub Check: Lint

[failure] 65-65:
Expected indentation of 4 spaces but found 2


[failure] 64-64:
Expected indentation of 6 spaces but found 4


[failure] 63-63:
Expected indentation of 4 spaces but found 2


[failure] 62-62:
Expected indentation of 2 spaces but found 0

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f196b47 and d0c4c92.

📒 Files selected for processing (2)
  • src/components/Modal/Modal.react.js (4 hunks)
  • src/components/Modal/Modal.scss (1 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint
src/components/Modal/Modal.react.js

[failure] 65-65:
Expected indentation of 4 spaces but found 2


[failure] 64-64:
Expected indentation of 6 spaces but found 4


[failure] 63-63:
Expected indentation of 4 spaces but found 2


[failure] 62-62:
Expected indentation of 2 spaces but found 0


[failure] 60-60:
Expected indentation of 2 spaces but found 0


[failure] 59-59:
Expected indentation of 4 spaces but found 2


[failure] 58-58:
Expected indentation of 6 spaces but found 4


[failure] 57-57:
Expected indentation of 4 spaces but found 2


[failure] 56-56:
Expected indentation of 4 spaces but found 2


[failure] 55-55:
Expected indentation of 4 spaces but found 2

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Docker linux/amd64

Copy link

uffizzi-cloud bot commented Jun 1, 2025

Uffizzi Ephemeral Environment deployment-64019

⌚ Updated Jun 01, 2025, 09:02 UTC

☁️ https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2838

📄 View Application Logs etc.

What is Uffizzi? Learn more

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 1, 2025
@dblythy
Copy link
Member Author

dblythy commented Jun 1, 2025

@coderabbitai review

Copy link

coderabbitai bot commented Jun 1, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (4)
src/components/Modal/Modal.react.js (4)

52-58: Indentation issues persist in handleMouseDown function.

The indentation in this function is still inconsistent with the rest of the file, as previously identified.


60-73: Memory leak addressed but indentation issues remain.

Good improvement using useCallback with proper dependencies to prevent memory leaks. However, the indentation issues within the function persist as previously noted.


75-80: Memory leak addressed but indentation issues remain.

Good improvement using useCallback. However, the indentation issues within the function persist as previously noted.


152-152: 🛠️ Refactor suggestion

Accessibility and usability improvements needed for resize handle.

The resize handle lacks several important features:

  1. Keyboard accessibility (as previously noted)
  2. ARIA labels for screen readers
  3. Touch device considerations (handle might be too small)
  4. Visual feedback for resize capability
-        <div className={styles.resizeHandle} onMouseDown={handleMouseDown} />
+        <div 
+          className={styles.resizeHandle} 
+          onMouseDown={handleMouseDown}
+          role="button"
+          tabIndex={0}
+          aria-label="Resize modal width"
+          title="Drag to resize modal width"
+        />
🧹 Nitpick comments (2)
src/components/Modal/Modal.react.js (2)

129-133: Consider performance optimization for frequent style updates.

The dynamic width updates on every mouse move could impact performance. Consider throttling or using CSS transforms instead of direct style updates.

-        style={{ width: currentWidth }}
+        style={{ width: currentWidth, transform: 'translateZ(0)' }}

The translateZ(0) creates a composite layer that can improve rendering performance during frequent updates.


52-90: Consider adding props to control resize behavior.

The resize functionality is always enabled and lacks configuration options. Consider adding props like resizable, minWidth, maxWidth for better control.

  customFooter,
  textModal = false,
  width,
  initialWidth = width ?? 500,
+ resizable = true,
+ minWidth = 300,
+ maxWidth,
  continueText,

Then update the clamp logic:

-      const clampedWidth = Math.min(window.innerWidth, Math.max(initialWidth, newWidth));
+      const maxAllowed = maxWidth || window.innerWidth;
+      const clampedWidth = Math.min(maxAllowed, Math.max(minWidth, newWidth));

And conditionally render the resize handle:

        {wrappedChildren}
        {footer}
-        <div className={styles.resizeHandle} onMouseDown={handleMouseDown} />
+        {resizable && <div className={styles.resizeHandle} onMouseDown={handleMouseDown} />}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0c4c92 and 85c9cc7.

📒 Files selected for processing (1)
  • src/components/Modal/Modal.react.js (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Docker linux/amd64
🔇 Additional comments (5)
src/components/Modal/Modal.react.js (5)

13-13: LGTM: Appropriate React hooks imported for resize functionality.

The addition of useState, useEffect, useRef, and useCallback imports is correct and necessary for implementing the modal resizing feature.


42-42: Good backward compatibility solution.

The implementation initialWidth = width ?? 500 effectively addresses the breaking change concern by providing backward compatibility while transitioning to the new prop name.


48-50: LGTM: Proper state and ref setup for resize functionality.

The refs and state initialization are correctly implemented for tracking modal reference, current width, and resize state.


82-90: Excellent improvement: Memory leak issue resolved.

The useEffect now properly includes handleMouseMove and handleMouseUp in the dependency array, preventing stale closures and memory leaks.


186-187: PropTypes documentation correctly updated.

Good addition of both width and initialWidth prop documentation, clearly indicating the legacy status of the width prop.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 1, 2025
@mtrezza mtrezza closed this Jun 1, 2025
@mtrezza mtrezza reopened this Jun 1, 2025
Copy link

uffizzi-cloud bot commented Jun 2, 2025

Uffizzi Ephemeral Environment deployment-64021

⌚ Updated Jun 02, 2025, 00:00 UTC

☁️ https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2838

📄 View Application Logs etc.

What is Uffizzi? Learn more

@mtrezza
Copy link
Member

mtrezza commented Jun 2, 2025

Please remove the resizing functionality from the modal corner and add it to the existing text input field corner. And make it resizable horizontally and verticall at the same time.

image

The issue with the resizing handle in the modal corner is that it's close to the "Save" button, which means one could accidentally save an unfinished entry when trying to resize.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
src/components/Modal/Modal.react.js (1)

41-42: Breaking change already flagged in previous reviews.

The renaming of width to initialWidth creates a breaking change that affects existing Modal component usage.

🧹 Nitpick comments (2)
src/components/Modal/Modal.react.js (2)

48-50: Improve the resizing state structure.

The resizing ref object structure could be more maintainable and the variable naming could be clearer.

-  const resizing = useRef({ active: false, side: null, startX: 0, startWidth: 0 });
+  const resizing = useRef({
+    active: false,
+    side: null,
+    startX: 0,
+    startWidth: 0
+  });

207-208: Update prop documentation to reflect current implementation.

The prop descriptions should clarify the current behavior and the relationship between the legacy and new props.

-  width: PropTypes.number.describe('custom width of modal (legacy prop, prefer initialWidth).'),
-  initialWidth: PropTypes.number.describe('custom width of modal.'),
+  width: PropTypes.number.describe('Legacy prop for modal width. Use initialWidth instead.'),
+  initialWidth: PropTypes.number.describe('Initial width of the resizable modal. Defaults to 500px.'),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 85c9cc7 and 956661b.

📒 Files selected for processing (1)
  • src/components/Modal/Modal.react.js (4 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint
src/components/Modal/Modal.react.js

[failure] 69-69:
Expected { after 'if' condition


[failure] 57-57:
Expected { after 'if' condition

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Docker linux/amd64
🔇 Additional comments (2)
src/components/Modal/Modal.react.js (2)

13-13: LGTM: React hooks import updated appropriately.

The addition of the required React hooks for the resize functionality is correct.


91-98: Event listener management looks good.

The useEffect properly handles adding and removing global event listeners with correct dependencies.

Comment on lines +67 to +82
const handleMouseMove = useCallback(
(e) => {
if (!resizing.current.active || !modalRef.current) return;
const { side, startX, startWidth } = resizing.current;
if (side === 'right') {
let newWidth = startWidth + 2 * (e.clientX - startX);
newWidth = Math.max(minWidth, newWidth);
setCurrentWidth(newWidth);
} else if (side === 'left') {
let newWidth = startWidth - 2 * (e.clientX - startX);
newWidth = Math.max(minWidth, newWidth);
setCurrentWidth(newWidth);
}
},
[minWidth]
);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix missing braces and problematic resize logic.

Multiple issues with this implementation:

  1. Missing braces after if condition (line 69)
  2. Arbitrary 2x multiplier makes resizing overly sensitive
  3. No maximum width constraint
-      if (!resizing.current.active || !modalRef.current) return;
+      if (!resizing.current.active || !modalRef.current) {
+        return;
+      }
-        let newWidth = startWidth + 2 * (e.clientX - startX);
+        let newWidth = startWidth + (e.clientX - startX);
-        newWidth = Math.max(minWidth, newWidth);
+        newWidth = Math.min(window.innerWidth - 40, Math.max(minWidth, newWidth));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleMouseMove = useCallback(
(e) => {
if (!resizing.current.active || !modalRef.current) return;
const { side, startX, startWidth } = resizing.current;
if (side === 'right') {
let newWidth = startWidth + 2 * (e.clientX - startX);
newWidth = Math.max(minWidth, newWidth);
setCurrentWidth(newWidth);
} else if (side === 'left') {
let newWidth = startWidth - 2 * (e.clientX - startX);
newWidth = Math.max(minWidth, newWidth);
setCurrentWidth(newWidth);
}
},
[minWidth]
);
const handleMouseMove = useCallback(
(e) => {
if (!resizing.current.active || !modalRef.current) {
return;
}
const { side, startX, startWidth } = resizing.current;
if (side === 'right') {
let newWidth = startWidth + (e.clientX - startX);
newWidth = Math.min(window.innerWidth - 40, Math.max(minWidth, newWidth));
setCurrentWidth(newWidth);
} else if (side === 'left') {
let newWidth = startWidth - 2 * (e.clientX - startX);
newWidth = Math.max(minWidth, newWidth);
setCurrentWidth(newWidth);
}
},
[minWidth]
);
🧰 Tools
🪛 GitHub Check: Lint

[failure] 69-69:
Expected { after 'if' condition

🤖 Prompt for AI Agents
In src/components/Modal/Modal.react.js lines 67 to 82, add braces after the if
condition on line 69 to properly enclose the block. Remove the arbitrary 2x
multiplier in the width calculation to make resizing less sensitive. Also,
introduce a maximum width constraint and ensure the new width is clamped between
minWidth and maxWidth before calling setCurrentWidth.

Comment on lines +144 to +155
{/* Left resize handle */}
<div
className={styles.resizeHandleLeft}
style={{ position: 'absolute', left: 0, top: 0, width: 8, height: '100%', cursor: 'ew-resize', zIndex: 10 }}
onMouseDown={handleMouseDown('left')}
/>
{/* Right resize handle */}
<div
className={styles.resizeHandleRight}
style={{ position: 'absolute', right: 0, top: 0, width: 8, height: '100%', cursor: 'ew-resize', zIndex: 10 }}
onMouseDown={handleMouseDown('right')}
/>
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

Implementation doesn't match reviewer requirements.

Critical mismatch with reviewer feedback:

  1. Reviewer specifically requested moving resize handle to text input field corner, not modal edges
  2. Reviewer requested both horizontal AND vertical resizing, but this only implements horizontal
  3. Handles are positioned at modal edges which conflicts with the Save button as mentioned in PR comments

The current implementation needs to be redesigned to:

  • Place resize handle on text input field corner (not modal edges)
  • Support both horizontal and vertical resizing
  • Avoid interference with the Save button

Should I help redesign this to match the reviewer's specifications?


Redesign resize handles to meet spec

The current code in src/components/Modal/Modal.react.js (lines 144–155) only adds horizontal resize grips at the modal edges and will overlap the Save button. The requirements call for a corner-based handle on the text input field that supports both horizontal and vertical resizing.

Please update as follows:

  • Move the resize handle into the text-input wrapper (not on the modal container).
  • Position it at the bottom-right corner of that input (e.g. wrap <input> in a position: relative container, then absolutely position the handle at bottom: 0; right: 0).
  • Replace the two edge handles with a single corner handle that uses a diagonal cursor (nwse-resize) and invokes your bidirectional resize logic.
  • Implement vertical resizing (e.g. handleMouseDown('bottom') or a unified handleMouseDown('corner') that handles both axes).
  • Verify it doesn’t collide with the Save button (adjust z-index/offsets if needed).

Example diff snippet:

-        {/* Left resize handle */}
-        <div
-          className={styles.resizeHandleLeft}
-          style={{ position: 'absolute', left: 0, top: 0, width: 8, height: '100%', cursor: 'ew-resize', zIndex: 10 }}
-          onMouseDown={handleMouseDown('left')}
-        />
-        {/* Right resize handle */}
-        <div
-          className={styles.resizeHandleRight}
-          style={{ position: 'absolute', right: 0, top: 0, width: 8, height: '100%', cursor: 'ew-resize', zIndex: 10 }}
-          onMouseDown={handleMouseDown('right')}
-        />
+        {/* Corner resize handle on text input */}
+        <div
+          className={styles.resizeHandleCorner}
+          style={{
+            position: 'absolute',
+            bottom: 0,
+            right: 0,
+            width: 8,
+            height: 8,
+            cursor: 'nwse-resize',
+            zIndex: 10
+          }}
+          onMouseDown={handleMouseDown('corner')}
+        />

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/components/Modal/Modal.react.js around lines 144 to 155, replace the two
horizontal resize handles positioned at the modal edges with a single resize
handle placed at the bottom-right corner of the text input field's wrapper. Wrap
the input in a relative container and absolutely position the handle at bottom:
0 and right: 0 with a diagonal cursor (nwse-resize). Update the onMouseDown
handler to support bidirectional resizing (both horizontal and vertical) by
using a unified event like handleMouseDown('corner'). Ensure the handle's
z-index and positioning prevent overlap with the Save button.

Comment on lines +55 to +65
const handleMouseDown = (side) => (e) => {
e.preventDefault();
if (!modalRef.current) return;
resizing.current = {
active: true,
side,
startX: e.clientX,
startWidth: currentWidth,
};
modalRef.current.classList.add(styles.noTransition);
};
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Fix missing braces and address reviewer feedback on handle placement.

Two critical issues:

  1. Missing braces after if condition (static analysis error)
  2. Current implementation doesn't match reviewer's request to move resize handle to text input corner
-    if (!modalRef.current) return;
+    if (!modalRef.current) {
+      return;
+    }

More importantly, according to PR comments, the reviewer requested moving the resize handle from the modal corner to the text input field corner to avoid conflicts with the Save button. The current implementation still places handles on modal edges.


🏁 Script executed:

#!/bin/bash
# Locate handleMouseDown definition and its usage in the Modal component
echo "---- handleMouseDown definition ----"
rg -n "handleMouseDown" -C3 src/components/Modal/Modal.react.js

echo "---- Context around resizing.current usage ----"
rg -n "resizing.current" -C3 src/components/Modal/Modal.react.js

echo "---- Search for render of resize handles ----"
rg -n "<.*handle" -C3 src/components/Modal/Modal.react.js || echo "No obvious handle elements found"

echo "---- ESLint curly rule configuration ----"
grep -R "\"curly\"" -n .eslintrc* || echo "No curly rule found in ESLint config"

Length of output: 2448


Add braces to the early return and relocate resize handles to the input field corners

The if (!modalRef.current) return; remains a single‐line statement and needs braces for consistency (and to satisfy any “curly” lint rules). More importantly, the resize handles are still rendered at the modal edges instead of at the text input’s corners as requested.

• File: src/components/Modal/Modal.react.js
– Lines 55–57: wrap the early return in braces
diff - if (!modalRef.current) return; + if (!modalRef.current) { + return; + }
• File: src/components/Modal/Modal.react.js
– Lines 145–155: the <div className={styles.resizeHandleLeft}> and <div className={styles.resizeHandleRight}> are still absolutely positioned at the modal’s left/right edges. Per PR feedback, these handles should be moved inside the text input wrapper (e.g. attach to top‐left and top‐right of the input element) to avoid overlapping the Save button.
– Adjust the markup and positioning so that the handles render at the input field’s corners rather than the modal frame.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleMouseDown = (side) => (e) => {
e.preventDefault();
if (!modalRef.current) return;
resizing.current = {
active: true,
side,
startX: e.clientX,
startWidth: currentWidth,
};
modalRef.current.classList.add(styles.noTransition);
};
const handleMouseDown = (side) => (e) => {
e.preventDefault();
if (!modalRef.current) {
return;
}
resizing.current = {
active: true,
side,
startX: e.clientX,
startWidth: currentWidth,
};
modalRef.current.classList.add(styles.noTransition);
};
🧰 Tools
🪛 GitHub Check: Lint

[failure] 57-57:
Expected { after 'if' condition

🤖 Prompt for AI Agents
In src/components/Modal/Modal.react.js around lines 55 to 57, add braces around
the early return statement after the if condition to comply with curly brace
lint rules. Then, in lines 145 to 155, move the resize handle elements from the
modal edges to be inside the text input wrapper, positioning them at the
top-left and top-right corners of the input field instead of the modal frame, to
prevent overlap with the Save button. Adjust the JSX markup and CSS styles
accordingly to reflect this new placement.

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.

Allow config parameter dialog to be resized in width
3 participants