-
Couldn't load subscription status.
- Fork 391
Use scrollIntoView to keep active workflow tab visible #6077
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
Conversation
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 10/15/2025, 06:49:45 PM UTC 🔗 Links🎉 Your Storybook is ready for review! |
🎭 Playwright Test Results⏰ Completed at: 10/15/2025, 07:13:33 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
|
the adjacent ts code in WorkflowTabs.vue has some suspicious parts with bugs in not stopping watcchers and poking into $el internals, but it's out of scope for this |
|
codex did not post the link it's here: #6080 honestly optional to review, can drop it entirely, no biggie |
| const offsetLeft = tabRect.left - containerRect.left | ||
| const offsetRight = tabRect.right - containerRect.right | ||
| activeTabElement.scrollIntoView({ block: 'nearest', inline: 'nearest' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[quality] medium Priority
Issue: Missing error handling for DOM operations that could fail
Context: The scrollIntoView method can throw errors if the element is not properly attached to DOM or if scrolling is restricted
Suggestion: Wrap the scrollIntoView call in a try-catch block to handle potential DOM exceptions gracefully
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non blocking
| '.p-scrollpanel-content' | ||
| ) | ||
| if (!container) return | ||
| const scrollPanelElement = scrollPanelRef.value?.$el as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[performance] low Priority
Issue: Potentially redundant DOM queries in scroll behavior
Context: The function queries scrollPanelElement and then queries within it, but could cache the scroll panel content element for better performance
Suggestion: Consider caching the scroll panel content element reference to avoid repeated queries, especially since this function is called frequently during scroll events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non blocking
| () => workflowStore.activeWorkflow, | ||
| async () => { | ||
| if (!selectedWorkflow.value) return | ||
| const ensureActiveTabVisible = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[architecture] low Priority
Issue: Function scope could be better optimized for component lifecycle
Context: The ensureActiveTabVisible function is defined in component scope but could benefit from being memoized or having better lifecycle management
Suggestion: Consider using useMemo or moving to a composable if this function will be reused across components, or add better cancellation for pending async operations when component unmounts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non blocking
| const offsetLeft = tabRect.left - containerRect.left | ||
| const offsetRight = tabRect.right - containerRect.right | ||
| activeTabElement.scrollIntoView({ block: 'nearest', inline: 'nearest' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[quality] low Priority
Issue: ScrollIntoView options may not be supported in all target browsers
Context: The block: 'nearest' and inline: 'nearest' options are relatively modern features that may not be supported in older browsers
Suggestion: Consider checking browser compatibility requirements or add a fallback for older browsers. Alternatively, document the minimum browser version requirements if not already specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non blocking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comprehensive PR Review
This review is generated by Claude. It may not always be accurate, as with human reviewers. If you believe that any of the comments are invalid or incorrect, please state why for each. For others, please implement the changes in one way or another.
Review Summary
PR: Use scrollIntoView to keep active workflow tab visible (#6077)
Impact: 19 additions, 22 deletions across 1 file
Issue Distribution
- Critical: 0
- High: 0
- Medium: 1
- Low: 3
Category Breakdown
- Architecture: 1 issue
- Security: 0 issues
- Performance: 1 issue
- Code Quality: 2 issues
Key Findings
Architecture & Design
The change follows Vue 3 Composition API patterns correctly and maintains the established component structure. The refactored function ensureActiveTabVisible provides better separation of concerns by extracting the scroll logic into a dedicated function. However, consider lifecycle management optimizations for better component performance.
Security Considerations
No security vulnerabilities identified. The DOM manipulation uses safe element queries and doesn't introduce XSS or injection risks.
Performance Impact
The simplified scrollIntoView approach should be more performant than manual getBoundingClientRect calculations. However, there are opportunities for optimization through DOM query caching and better error handling.
Integration Points
This change maintains backward compatibility with existing scroll behavior and doesn't affect the extension system or other components. The fix addresses issue #6057 regarding hidden active tabs.
Positive Observations
- Clean simplification that replaces complex manual scroll calculations with native browser API
- Maintains proper Vue 3 Composition API patterns
- Good separation of concerns with extracted function
- Proper null checking and early returns
- Resolves the reported bug effectively
References
Next Steps
- Address the medium priority error handling issue before merge
- Consider the low priority performance and architecture improvements for future iterations
- Verify browser compatibility if targeting older browsers
- Test the scroll behavior across different screen sizes and tab configurations
This is a comprehensive automated review. For architectural decisions requiring human judgment, please request additional manual review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
> "The watcher that should keep the active workflow tab visible compares the tab’s bounds against the scroll panel’s content element, whose rectangle spans the entire scroll width instead of the visible viewport. As a result, when the active tab starts off-screen, the computed offsets stay ≤ 0 and no corrective scroll occurs, so the selected tab remains hidden." fixes #6057 ------ https://chatgpt.com/codex/tasks/task_e_68efe2b5b4a08330940a20552c1db339
fixes #6057
https://chatgpt.com/codex/tasks/task_e_68efe2b5b4a08330940a20552c1db339