fix: Position error messages relative to editor instead of viewport#152
Open
fix: Position error messages relative to editor instead of viewport#152
Conversation
Error messages now appear at the top-right of the editor container rather than fixed at the viewport top. This ensures errors are visible near where the user is working, even on long pages or with multiple editors. Changes: - Updated CSS to use absolute positioning instead of fixed - Added max-width and improved styling for better readability - Modified error tooltip to be appended to editor container - Implemented actual positioning using editorRect data - Ensured parent container has relative positioning Fixes positioning issues related to #62 and #132 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes error message positioning to appear relative to the editor container instead of being fixed to the viewport. This addresses the remaining positioning issues from #62 and #132.
Problem
While z-index issues were previously resolved, error messages still appeared at a fixed position (
top: 0, right: 10px) relative to the viewport. This caused poor UX:editorRectbut never used it for positioningChanges
CSS (
theme/style.css)position: fixedtoposition: absolutefor editor-relative positioningtop: 0andright: 10pxmax-width: 400pxfor better readability on wide screenspointer-events: noneto prevent interaction interferenceTypeScript (
src/aiagentui.ts)addGptErrorToolTip(): Now appends tooltip to editor container instead ofdocument.bodyshowGptErrorToolTip(): Calculates and applies position based on editor boundshideGptErrorToolTip(): Updated to find tooltip within editor containerposition: relativefor proper absolute positioningTesting Instructions
Setup
git checkout fix/error-message-positioningyarn installyarn build:distyarn startTest Case 1: Error Position with Single Editor
Objective: Verify error appears at top-right of editor
/write testand press Enter)Test Case 2: Multiple Editors
Objective: Verify error appears on the correct editor
Test Case 3: Long Page / Scrolled Editor
Objective: Verify error is visible even when editor is scrolled
Test Case 4: Editor in Modal/Dialog
Objective: Verify error positioning in constrained spaces
Test Case 5: Error Message Duration
Objective: Verify error auto-dismisses correctly
showErrorDuration)Test Case 6: Error Message Content
Objective: Verify error text wraps properly
max-width: 400pxVisual Inspection Checklist
max-width: 400pxand wraps long textRegression Testing
Verify these existing features still work:
Related Issues
Screenshots
Before (fixed to viewport)
Error appears at
top: 0, right: 10pxof viewport regardless of editor position.After (relative to editor)
Error appears at top-right of the editor container, moving with the editor.
🤖 Generated with Claude Code