Skip to content

Comments

fix: 优化右侧面板 UI#80

Open
eya46 wants to merge 1 commit intoMistEO:mainfrom
eya46:fix/panel-ui
Open

fix: 优化右侧面板 UI#80
eya46 wants to merge 1 commit intoMistEO:mainfrom
eya46:fix/panel-ui

Conversation

@eya46
Copy link

@eya46 eya46 commented Feb 21, 2026

优化下

  1. 填充hover标题后背景色和border四个角之间的缝
  2. 等待折叠完后再设置标题栏的背景圆角
  3. 设置下运行日志的高度,避免小窗口挤压成线
  4. 调整日志滚动的实现

Summary by Sourcery

改进右侧面板的布局、滚动行为,以及悬停/聚焦视觉效果,使界面更流畅且更具可访问性。

增强内容:

  • 更新日志面板的容器和滚动方式,在较小窗口中保持布局的同时,确保最新日志始终可见。
  • 统一右侧面板的外壳样式,使用内嵌描边边框和溢出处理,以获得更干净的边缘和一致的视觉风格。
  • 优化面板标题的悬停和聚焦状态,包括键盘交互和圆角过渡,以消除视觉空隙并提升可访问性。
  • 根据右侧面板的展开状态调整其溢出行为,避免在小视口中内容被压缩。
Original summary in English

Summary by Sourcery

Improve the right-side panels’ layout, scrolling behavior, and hover/focus visuals for a smoother and more accessible UI.

Enhancements:

  • Update logs panel container and scrolling to keep the latest logs in view while preserving layout in smaller windows.
  • Unify right-side panel shells to use inset ring borders and overflow handling for cleaner edges and consistent styling.
  • Refine panel header hover and focus states, including keyboard interaction and border-radius transitions, to remove visual gaps and improve accessibility.
  • Adjust right panel overflow behavior based on expansion state to avoid content being squashed in small viewports.

Copilot AI review requested due to automatic review settings February 21, 2026 12:12
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我发现了两个问题,并给出了一些整体性的反馈:

  • LogsPanel 中新增的 scrollTo({ behavior: 'smooth' }) 会在每次 logs 变化时运行;建议只在用户本来就接近底部时才自动滚动,以避免和用户滚动“打架”,并减少在日志快速更新时可能出现的性能问题或卡顿。
  • ScreenshotPanel 中,标题栏仍然是带有 role="button" 和自定义 onKeyDown 处理逻辑的 div;为了语义更合理,并与 ConnectionPanel 保持一致,建议将其改为真正的 <button> 元素,让浏览器自行处理键盘交互。
  • 用来协调 background-colorborder-radius 动画时间的内联 transition 样式在 ScreenshotPanelConnectionPanel 中是重复的;建议将其提取到一个共享的 class 或 helper 中,以便保持行为一致并让维护更容易。
给 AI Agent 的提示
Please address the comments from this code review:

## Overall Comments
- The new `scrollTo({ behavior: 'smooth' })` in `LogsPanel` runs on every `logs` change; consider only auto-scrolling when the user is already near the bottom to avoid fighting user scroll and potential performance/jank during rapid log updates.
- In `ScreenshotPanel`, the title bar is still a `div` with `role="button"` and custom `onKeyDown` handling; for better semantics and consistency with `ConnectionPanel`, consider switching this to a real `<button>` element and letting the browser handle keyboard interaction.
- The inline `transition` style for coordinating `background-color` and `border-radius` timing is duplicated between `ScreenshotPanel` and `ConnectionPanel`; consider extracting this into a shared class or helper to keep the behavior consistent and easier to maintain.

## Individual Comments

### Comment 1
<location> `src/components/LogsPanel.tsx:127-128` </location>
<code_context>
           {/* 右侧信息面板 */}
           {!rightPanelCollapsed && (
             <div
-              className={`flex flex-col p-3 bg-bg-primary overflow-y-auto overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3' : ''}`}
+              className={`flex flex-col p-3 bg-bg-primary overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3 overflow-y-auto' : 'overflow-hidden'}`}
</code_context>

<issue_to_address>
**issue (bug_risk):** The clickable header `div` isn't keyboard-focusable despite `role="button"` and key handlers.

Because it lacks `tabIndex={0}`, this `div` can’t be reached via keyboard focus, so the key handlers and focus styles won’t actually be usable for keyboard users. Please add `tabIndex={0}` or, preferably, convert it to a semantic `<button>` to ensure consistent, accessible keyboard interaction.
</issue_to_address>

### Comment 2
<location> `src/components/ScreenshotPanel.tsx:509-510` </location>
<code_context>
           {/* 右侧信息面板 */}
           {!rightPanelCollapsed && (
             <div
-              className={`flex flex-col p-3 bg-bg-primary overflow-y-auto overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3' : ''}`}
+              className={`flex flex-col p-3 bg-bg-primary overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3 overflow-y-auto' : 'overflow-hidden'}`}
</code_context>

<issue_to_address>
**issue (bug_risk):** The screenshot panel header `div` with `role="button"` is not keyboard-focusable.

This header uses `role="button"`, an `onKeyDown` handler, and focus-visible styles, but without `tabIndex={0}` it can’t be reached via keyboard. Add `tabIndex={0}` or use a `<button>` so the semantics and behavior match and keyboard users can see and use the focus state.
</issue_to_address>

Sourcery 对开源项目是免费的——如果你觉得我们的代码审查有帮助,欢迎考虑分享给他人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've found 2 issues, and left some high level feedback:

  • The new scrollTo({ behavior: 'smooth' }) in LogsPanel runs on every logs change; consider only auto-scrolling when the user is already near the bottom to avoid fighting user scroll and potential performance/jank during rapid log updates.
  • In ScreenshotPanel, the title bar is still a div with role="button" and custom onKeyDown handling; for better semantics and consistency with ConnectionPanel, consider switching this to a real <button> element and letting the browser handle keyboard interaction.
  • The inline transition style for coordinating background-color and border-radius timing is duplicated between ScreenshotPanel and ConnectionPanel; consider extracting this into a shared class or helper to keep the behavior consistent and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `scrollTo({ behavior: 'smooth' })` in `LogsPanel` runs on every `logs` change; consider only auto-scrolling when the user is already near the bottom to avoid fighting user scroll and potential performance/jank during rapid log updates.
- In `ScreenshotPanel`, the title bar is still a `div` with `role="button"` and custom `onKeyDown` handling; for better semantics and consistency with `ConnectionPanel`, consider switching this to a real `<button>` element and letting the browser handle keyboard interaction.
- The inline `transition` style for coordinating `background-color` and `border-radius` timing is duplicated between `ScreenshotPanel` and `ConnectionPanel`; consider extracting this into a shared class or helper to keep the behavior consistent and easier to maintain.

## Individual Comments

### Comment 1
<location> `src/components/LogsPanel.tsx:127-128` </location>
<code_context>
           {/* 右侧信息面板 */}
           {!rightPanelCollapsed && (
             <div
-              className={`flex flex-col p-3 bg-bg-primary overflow-y-auto overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3' : ''}`}
+              className={`flex flex-col p-3 bg-bg-primary overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3 overflow-y-auto' : 'overflow-hidden'}`}
</code_context>

<issue_to_address>
**issue (bug_risk):** The clickable header `div` isn't keyboard-focusable despite `role="button"` and key handlers.

Because it lacks `tabIndex={0}`, this `div` can’t be reached via keyboard focus, so the key handlers and focus styles won’t actually be usable for keyboard users. Please add `tabIndex={0}` or, preferably, convert it to a semantic `<button>` to ensure consistent, accessible keyboard interaction.
</issue_to_address>

### Comment 2
<location> `src/components/ScreenshotPanel.tsx:509-510` </location>
<code_context>
           {/* 右侧信息面板 */}
           {!rightPanelCollapsed && (
             <div
-              className={`flex flex-col p-3 bg-bg-primary overflow-y-auto overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3' : ''}`}
+              className={`flex flex-col p-3 bg-bg-primary overflow-x-hidden border-l border-transparent ${sidePanelExpanded ? 'gap-3 overflow-y-auto' : 'overflow-hidden'}`}
</code_context>

<issue_to_address>
**issue (bug_risk):** The screenshot panel header `div` with `role="button"` is not keyboard-focusable.

This header uses `role="button"`, an `onKeyDown` handler, and focus-visible styles, but without `tabIndex={0}` it can’t be reached via keyboard. Add `tabIndex={0}` or use a `<button>` so the semantics and behavior match and keyboard users can see and use the focus state.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 127 to 128
<div
role="button"
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): 可点击的标题 div 虽然使用了 role="button" 和按键处理函数,但仍然无法通过键盘聚焦。

由于缺少 tabIndex={0},这个 div 无法通过键盘获得焦点,因此按键处理逻辑和焦点样式实际上对键盘用户不可用。请添加 tabIndex={0},或者(更推荐)将其改为语义化的 <button> 元素,以确保一致且可访问的键盘交互体验。

Original comment in English

issue (bug_risk): The clickable header div isn't keyboard-focusable despite role="button" and key handlers.

Because it lacks tabIndex={0}, this div can’t be reached via keyboard focus, so the key handlers and focus styles won’t actually be usable for keyboard users. Please add tabIndex={0} or, preferably, convert it to a semantic <button> to ensure consistent, accessible keyboard interaction.

Comment on lines 509 to 510
<div
role="button"
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): 截图面板的标题 div 使用了 role="button",但无法通过键盘聚焦。

这个标题同时使用了 role="button"onKeyDown 处理函数以及 focus-visible 样式,但在没有 tabIndex={0} 的情况下,用户无法通过键盘聚焦到它。请添加 tabIndex={0},或者改用 <button>,以便语义和行为保持一致,并让键盘用户能够看到并使用焦点状态。

Original comment in English

issue (bug_risk): The screenshot panel header div with role="button" is not keyboard-focusable.

This header uses role="button", an onKeyDown handler, and focus-visible styles, but without tabIndex={0} it can’t be reached via keyboard. Add tabIndex={0} or use a <button> so the semantics and behavior match and keyboard users can see and use the focus state.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request optimizes the UI of the right-side panel components by addressing visual glitches and improving layout behavior. The changes focus on fixing border-radius rendering gaps, improving transition timing, and enhancing scroll behavior.

Changes:

  • Replaced border border-border with ring-1 ring-inset ring-border + overflow-hidden to eliminate visual gaps between borders and rounded corners
  • Added delayed border-radius transitions to prevent visual glitches during panel collapse animations
  • Improved logs auto-scroll implementation using scrollTo on container instead of scrollIntoView
  • Added minimum height constraint to LogsPanel and refined overflow behavior in right panel container

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/components/ScreenshotPanel.tsx Updated border styling to use ring utilities, added delayed border-radius transition, changed keyboard handler to use .click(), and improved focus styling
src/components/LogsPanel.tsx Applied consistent ring-based borders, changed scroll implementation to use container ref with scrollTo, added minimum height constraint, and removed sentinel element
src/components/ConnectionPanel.tsx Updated to ring-based border styling with delayed border-radius transition for consistency with other panels
src/App.tsx Refined overflow behavior to conditionally apply vertical scrolling only when side panel is expanded


return (
<div className="flex-1 flex flex-col bg-bg-secondary rounded-lg border border-border overflow-hidden">
<div className="flex-1 flex flex-col bg-bg-secondary rounded-lg ring-1 ring-inset ring-border overflow-hidden min-h-50">
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

The class min-h-50 translates to min-height: 12.5rem (200px) in Tailwind CSS. This is likely too large for a minimum height constraint on a logs panel that should be flexible. Consider using a smaller value like min-h-32 (128px) or min-h-24 (96px) to better match typical UI requirements while still preventing excessive compression in small windows.

Suggested change
<div className="flex-1 flex flex-col bg-bg-secondary rounded-lg ring-1 ring-inset ring-border overflow-hidden min-h-50">
<div className="flex-1 flex flex-col bg-bg-secondary rounded-lg ring-1 ring-inset ring-border overflow-hidden min-h-32">

Copilot uses AI. Check for mistakes.
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.

1 participant