| name | frontend-ui-details-fix |
| description | Fixes UI/UX details like boundary handling, tooltips, settings panels, responsive design, accessibility, and visual consistency. Invoke when core features work but details have issues. |
Frontend UI Details Fix Workflow
Use this workflow to fix UI/UX details issues that are often overlooked during core feature development.
Common Issues Checklist
1. Boundary & Edge Handling
Overflow Issues
Border & Spacing
- Check: Inconsistent borders, padding, margins
- Fixes:
- Use consistent spacing scale (4px, 8px, 16px, 24px, 32px)
- Add proper borders to cards, modals, panels
- Handle 0-height/0-width elements
- Ant Design: Use
space component for consistent spacing
2. Tooltip & Hover States
Tooltips
Hover States
- Check: Missing hover effects on interactive elements
- Fixes:
<Table
onRow={(record) => ({
onMouseEnter: () => setHoveredRow(record.id),
onMouseLeave: () => setHoveredRow(null),
className: hoveredRow === record.id ? 'bg-blue-50' : ''
})}
/>
<Card
hoverable
className="transition-all hover:shadow-lg hover:-translate-y-1"
/>
- CSS:
hover:bg-..., hover:shadow-..., transition-all, duration-200
3. Settings & Configuration Panels
Settings Layout
Settings Persistence
4. Top Right Notification/Menu Area
User Menu
- Check: User dropdown is often missing important items
- Required Items:
- User info (name, avatar, role)
- Settings link
- Logout button
- Profile/Account settings
- Example:
<Dropdown
menu={{
items: [
{
key: 'profile',
icon: <UserOutlined />,
label: 'Profile'
},
{
key: 'settings',
icon: <SettingOutlined />,
label: 'Settings'
},
{ type: 'divider' },
{
key: 'logout',
icon: <LogoutOutlined />,
label: 'Logout',
danger: true
}
]
}}
>
<Space className="cursor-pointer">
<Avatar src={user.avatar} />
<span>{user.name}</span>
</Space>
</Dropdown>
Notifications
5. Loading & Empty States
Loading States
Empty States
6. Responsive Design
Mobile Responsiveness
7. Accessibility (A11y)
Keyboard Navigation
Screen Reader Support
Color Contrast
- Check: Text hard to read
- Fixes:
- Use Ant Design's color system
- WCAG AA: 4.5:1 ratio for normal text
- WCAG AA: 3:1 ratio for large text
8. Error Handling
Form Validation
- Check: Validation feedback is unclear
- Fixes:
<Form.Item
name="email"
rules={[
{ required: true, message: 'Email is required' },
{ type: 'email', message: 'Invalid email format' }
]}
help="We'll send a confirmation email"
>
<Input placeholder="email@example.com" />
</Form.Item>
Error Boundaries
Error Messages
9. Performance Issues
Unnecessary Re-renders
Large Lists
Common Patterns to Apply
Page Layout Pattern
export default function PageName() {
return (
<div className="p-6">
<PageHeader
title="Page Title"
extra={[
<Button key="create">Create</Button>,
<Button key="refresh">Refresh</Button>
]}
/>
<Card className="mt-4">
{/* Content */}
</Card>
</div>
);
}
Detail View Pattern
export default function DetailView({ id }) {
const { data, loading } = useDetail(id);
if (loading) return <Spin />;
if (!data) return <Empty />;
return (
<PageLayout>
<DescriptionItems
title="基本信息"
items={[
{ label: '名称', value: data.name },
{ label: '状态', value: <Tag>{data.status}</Tag> },
// ...
]}
/>
<Tabs
items={[
{ key: 'details', label: '详情', children: <Details /> },
{ key: 'history', label: '历史', children: <History /> },
]}
/>
</PageLayout>
);
}
List View Pattern
export default function ListView() {
const { data, loading, pagination } = useList();
return (
<PageLayout>
<FilterBar />
<Table
loading={loading}
dataSource={data}
pagination={pagination}
scroll={{ x: 'max-content' }}
rowKey="id"
/>
</PageLayout>
);
}
Verification Checklist
Before closing a UI details fix task, verify:
Common Gotchas
-
Tooltip Position: On mobile, tooltips may appear off-screen. Use placement="bottom" or handle mobile separately.
-
Table Row Height: Fixed row heights can cause content truncation. Use pagination.pageSize carefully.
-
Modal Z-index: Multiple modals can stack incorrectly. Use Modal.config({ rootPrefixCls }) if needed.
-
Date Picker Range: Range picker needs enough width. width: 100% on mobile.
-
Select Dropdown: On mobile, native select is often better than Ant Design select.
-
Icon Imports: Always import from @ant-design/icons, not antd/es/icons.
-
Form.Item Layout: Use layout="vertical" on mobile for better UX.
-
Notification Auto-close: Set duration: 5 for success, 0 for errors (manual close).