致命
Defer Await
React
Async Waterfall
React/Next.js
应该
Move await operations into branches where they're needed
if (skip) return { skipped: true }; const data = await fetch()
不要
Await at top of function blocking all branches
const data = await fetch(); if (skip) return { skipped: true }
致命
Promise.all Parallel
React
Async Waterfall
React/Next.js
应该
Use Promise.all() for independent operations
const [user, posts] = await Promise.all([fetchUser(), fetchPosts()])
不要
Sequential await for independent operations
const user = await fetchUser(); const posts = await fetchPosts()
致命
Dependency Parallelization
React
Async Waterfall
React/Next.js
应该
Use better-all to start each task at earliest possible moment
await all({ user() {}, config() {}, profile() { return fetch((await this.$.user).id) } })
不要
Wait for unrelated data before starting dependent fetch
const [user, config] = await Promise.all([...]); const profile = await fetchProfile(user.id)
致命
API Route Optimization
React
Async Waterfall
React/Next.js
应该
Start promises early and await late
const sessionP = auth(); const configP = fetchConfig(); const session = await sessionP
不要
Sequential awaits in API handlers
const session = await auth(); const config = await fetchConfig()
致命
Barrel Imports
React
Bundle Size
React/Next.js
应该
Import directly from source path
import Check from 'lucide-react/dist/esm/icons/check'
不要
Import from barrel/index files
import { Check } from 'lucide-react'
致命
Dynamic Imports
React
Bundle Size
React/Next.js
应该
Use dynamic() for heavy components
const Monaco = dynamic(() => import('./monaco'), { ssr: false })
不要
Import heavy components at top level
import { MonacoEditor } from './monaco-editor'
致命
Parallel Fetching
React
Server
React/Next.js
应该
Use component composition for parallel fetches
<Header /><Sidebar /> // both fetch in parallel
不要
Sequential fetches in parent component
const header = await fetchHeader(); return <><div>{header}</div><Sidebar /></>
致命
Accessible Authentication (Minimum)
UX
Security / Accessibility
应该
Allow password managers and paste; offer passkeys OAuth or another non-cognitive method
autocomplete="current-password" and paste allowed
不要
Block paste or require manual OTP transcription with no alternative
onpaste preventDefault
致命
Text Reflow and Spacing
UX
Accessibility
Web
应该
Use fluid sizes content-driven height and unitless line height
.copy { inline-size: min(100%, 65ch); height: auto; line-height: 1.5; }
不要
Clip text in fixed-width or fixed-height boxes
.copy { width: 900px; height: 40px; overflow: hidden; }
致命
Essential Text Truncation
UX
Content
应该
Wrap stack resize or provide a visible full-detail path
Action label wraps or opens full details
不要
Clamp essential meaning only to make cards uniform
Primary action shown only as an unexplained ellipsis
致命
Compact Control Semantics
UX
Accessibility
Web
应该
Prefer a button and expose pressed or selected state that matches the visible label
<button aria-pressed='true'>Open now</button>
不要
Use a clickable div or reveal the only action on hover
<div class='selected' onclick='toggle()'>Open now</div>
致命
Icon Button Labels
Web
Accessibility
iOS/Android/React Native
应该
Set accessibilityLabel or label prop on icon buttons
<Pressable accessibilityLabel="Close"><XIcon /></Pressable>
不要
Icon buttons without accessible names
<Pressable><XIcon /></Pressable>
致命
Form Control Labels
Web
Accessibility
iOS/Android/React Native
应该
Pair Text label with input and set accessibilityLabel
<View><Text>Email</Text><TextInput accessibilityLabel="Email address" /></View>
不要
Inputs with placeholder only
<TextInput placeholder="Email" /></View>
致命
Touch Target Size
Web
Touch
iOS/Android/React Native
应该
Select 44pt for iOS and 48dp for Android at runtime; evaluate web targets separately against WCAG 2.5.8 and its exceptions
Platform.select({ ios: 44, android: 48 }); // web: evaluate 24 CSS px + WCAG exceptions
不要
Collapse iOS 44pt, Android 48dp, and web 24 CSS px into one cross-platform number
<Pressable><Icon size={16} /></Pressable>
致命
Back Behavior
Web
Navigation
iOS/Android/React Native
应该
Use navigation.goBack and keep screen state
onPress={() => navigation.goBack()}
不要
Reset stack or exit app unexpectedly
BackHandler.exitApp() on first press
致命
Respect Reduced Motion
Web
Animation
iOS/Android/React Native
应该
Check reduceMotionEnabled and simplify animations
if (reduceMotionEnabled) skipAnimation()
不要
Ignore user motion preferences
Always run complex parallax animations
致命
No Gesture-Only Actions
Web
Anti-Pattern
iOS/Android/React Native
应该
Provide visible buttons in addition to gestures
Swipe to delete + visible Delete button
不要
Rely on swipe/shake only with no UI affordance
Only shake device to undo with no UI
致命
Authentication Reuse
Web
Forms
iOS/Android/React Native
应该
Support password managers passkeys paste and prefilled confirmed values
textContentType="password" autoComplete="current-password"
不要
Force users to retype credentials or the same data in one flow
onPaste disabled
高
Suspense Boundaries
React
Async Waterfall
React/Next.js
应该
Wrap async components in Suspense boundaries
<Suspense fallback={<Skeleton />}><DataDisplay /></Suspense>
不要
Await data blocking entire page render
const data = await fetchData(); return <DataDisplay data={data} />
高
Conditional Loading
React
Bundle Size
React/Next.js
应该
Dynamic import when feature enabled
useEffect(() => { if (enabled) import('./heavy.js') }, [enabled])
不要
Import large modules unconditionally
import { heavyData } from './heavy.js'
高
LRU Cache Cross-Request
React
Server
React/Next.js
应该
Use LRU for cross-request caching
const cache = new LRUCache({ max: 1000, ttl: 5*60*1000 })
不要
Refetch same data on every request
Always fetch from database
高
Minimize Serialization
React
Server
React/Next.js
应该
Pass only needed fields to client components
<Profile name={user.name} />
不要
Pass entire objects to client
<Profile user={user} /> // 50 fields serialized
高
Content Visibility
React
Rendering
React/Next.js
应该
Use content-visibility for long lists
.item { content-visibility: auto; contain-intrinsic-size: 0 80px }
不要
Render all list items immediately
Render 1000 items without optimization
高
Smooth Scroll
UX
Navigation
Web
应该
Use scroll-behavior: smooth on html element
html { scroll-behavior: smooth; }
不要
Jump directly without transition
<a href='#section'> without CSS
高
Back Button
UX
Navigation
Mobile
应该
Preserve navigation history properly
history.pushState()
不要
Break browser/app back button behavior
location.replace()
高
Excessive Motion
UX
Animation
应该
Animate 1-2 key elements per view maximum
Single hero animation
不要
Animate everything that moves
animate-bounce on 5+ elements
高
Reduced Motion
UX
Animation
应该
Check prefers-reduced-motion media query
@media (prefers-reduced-motion: reduce)
不要
Ignore accessibility motion settings
No motion query check
高
Loading States
UX
Animation
应该
Use skeleton screens or spinners
animate-pulse skeleton
不要
Leave UI frozen with no feedback
Blank screen while loading
高
Hover vs Tap
UX
Animation
应该
Use click/tap for primary interactions
onClick handler
不要
Rely only on hover for important actions
onMouseEnter only
高
Z-Index Management
UX
Layout
Web
应该
Define z-index scale system (10 20 30 50)
z-10 z-20 z-50
不要
Use arbitrary large z-index values
z-[9999]
高
Content Jumping
UX
Layout
Web
应该
Reserve appropriate space or keep async states in a stable content-driven container
aspect-ratio for media; stable count slot for badges
不要
Insert compact text or media without a layout strategy
Badge insertion pushes toolbar actions
高
Touch Target Size
UX
Touch
Mobile
应该
Use 44pt on iOS and 48dp on Android; for web use the separate WCAG Target Size rule
iOS 44pt; Android 48dp; Web 24 CSS px plus WCAG exceptions
不要
Treat one unit or minimum as universal across platforms
w-6 h-6 buttons
高
Focus States
UX
Interaction
应该
Use a visible focus ring on every interactive control, including modal controls
focus:ring-2 focus:ring-blue-500
不要
Remove focus outline without replacement
outline-none without alternative
高
Loading Buttons
UX
Interaction
应该
Disable button and show loading state
disabled={loading} spinner
不要
Allow multiple clicks during processing
Button clickable while loading
高
Error Feedback
UX
Interaction
应该
Show clear error messages near problem
Red border + error message
不要
Silent failures with no feedback
No indication of error
高
Confirmation Dialogs
UX
Interaction
应该
Confirm before delete/irreversible actions
Are you sure modal
不要
Delete without confirmation
Direct delete on click
高
Color Contrast
UX
Accessibility
应该
Minimum 4.5:1 ratio for normal text
#333 on white (7:1)
不要
Low contrast text
#999 on white (2.8:1)
高
Color Only
UX
Accessibility
应该
Use icons/text in addition to color
Red text + error icon
不要
Red/green only for error/success
Red border only for error
高
Alt Text
UX
Accessibility
应该
Descriptive alt text for meaningful images
alt='Dog playing in park'
不要
Empty or missing alt attributes
alt='' for content images
高
ARIA Labels
UX
Accessibility
应该
Add aria-label for icon-only buttons
aria-label='Close menu'
不要
Icon buttons without labels
<button><Icon/></button>
高
Keyboard Navigation
UX
Accessibility
Web
应该
Keep tab order aligned with visual order and test every action without a pointer
tabIndex for custom order
不要
Keyboard traps or illogical tab order
Unreachable elements
高
Form Labels
UX
Accessibility
应该
Use label with for attribute or wrap input
<label for='email'>
不要
Placeholder-only inputs
placeholder='Email' only
高
Error Messages
UX
Accessibility
应该
Use aria-live or role=alert for errors
role='alert'
不要
Visual-only error indication
Red border only
高
Image Optimization
UX
Performance
应该
Use appropriate size and format (WebP)
srcset with multiple sizes
不要
Unoptimized full-size images
4000px image for 400px display
高
Input Labels
UX
Forms
应该
Always show label above or beside input
<label>Email</label><input>
不要
Placeholder as only label
placeholder='Email' only
高
Error Placement
UX
Forms
应该
Show a specific error below the input and reference it with aria-describedby
<input aria-describedby="email-error"><p id="email-error">Enter an email address</p>
不要
Show only a top-level error without identifying each invalid field
Red border or summary only
高
Submit Feedback
UX
Forms
应该
Show loading then success/error state
Loading -> Success message
不要
No feedback after submit
Button click with no response
高
Touch Friendly
UX
Responsive
Web
应该
Increase touch targets on mobile
Larger buttons on mobile
不要
Same tiny buttons on mobile
Desktop-sized targets on mobile
高
Readable Font Size
UX
Responsive
应该
Minimum 16px body text on mobile
text-base or larger
不要
Tiny text on mobile
text-xs for body text
高
Viewport Meta
UX
Responsive
Web
应该
Use width=device-width initial-scale=1
<meta name='viewport'...>
不要
Missing or incorrect viewport
No viewport meta tag
高
Horizontal Scroll
UX
Responsive
Web
应该
Ensure content fits viewport width
max-w-full overflow-x-hidden
不要
Content wider than viewport
Horizontal scrollbar on mobile
高
Contrast Readability
UX
Typography
应该
Use darker text on light backgrounds
text-gray-900 on white
不要
Gray text on gray background
text-gray-400 on gray-100
高
Loading Indicators
UX
Feedback
应该
Follow platform and component guidance; preserve layout focus and accessible busy status
Stable skeleton or progress with aria-busy
不要
Apply one timing threshold to every operation or leave long waits unexplained
Flickering spinner or frozen UI
高
Disclaimer
UX
AI Interaction
应该
Clearly label AI generated content
AI Assistant label
不要
Present AI as human
Fake human name without label
高
Gaze Hover
UX
Spatial UI
VisionOS
应该
Scale/highlight element on look
hoverEffect()
不要
Static element until pinch
onTap only
高
Motion Sensitivity
UX
Accessibility
应该
Honor prefers-reduced-motion and present the final readable state without parallax or scroll-jacking
@media (prefers-reduced-motion)
不要
Force scroll effects
ScrollTrigger.create()
高
Focus Not Obscured (Minimum)
UX
Accessibility
Web
应该
Offset sticky UI with scroll-padding and dismiss or move persistent overlays
scroll-padding-top: var(--header-height)
不要
Let headers footers banners or chat widgets fully cover focus
fixed overlay covers :focus
高
Dragging Movements
UX
Accessibility
应该
Add buttons menus or tap-to-move controls and retain keyboard operation
Move up and Move down buttons beside drag handle
不要
Make dragging the only way to reorder resize or select
drag handle only
高
Target Size (Minimum)
UX
Accessibility
Web
应该
Use at least 24 by 24 CSS px or verify spacing equivalent inline user-agent or essential exceptions
min-width: 24px; min-height: 24px
不要
Assume native 44pt or 48dp guidance defines web conformance
tiny adjacent icon buttons
高
Auto-Rotating Content Controls
UX
Animation
应该
Provide previous next and play/pause; stop on focus or hover and when reduced motion is requested
button aria-label="Pause carousel"
不要
Auto-advance slides without a stop control
timer-only carousel
高
Focusable Error Summary
UX
Forms / Accessibility
Web
应该
Place it at the top of the form; move focus to its heading or container after failed submit; link each item to its invalid field; retain inline errors
<div role="alert" tabindex="-1" aria-labelledby="error-title"><h2 id="error-title">There is a problem</h2><a href="#email">Enter an email address</a></div>
不要
Replace inline errors with a visual-only summary or move focus on every blur
Toast only with no field links or focus target
高
Long Token Wrapping
UX
Layout
Web
应该
Use overflow-wrap anywhere and let flex or grid text children shrink
.token { min-inline-size: 0; overflow-wrap: anywhere; }
不要
Apply word-break break-all to all prose
.token { white-space: nowrap; }
高
Compact Label Semantics
UX
Content
应该
Choose static or interactive markup from the label's meaning and ownership
<span class='status'>Pending</span>
不要
Make every pill clickable or encode status with color alone
<div class='pill' onclick='toggle()'>Pending</div>
高
Chip Collection Reflow
UX
Layout
应该
Wrap the collection or use an operable +n disclosure for hidden overflow values
<div class='chip-list'>{chips}</div> with flex-wrap
不要
Force all chips into one clipped row or hide overflow values
<div class='chip-list' style='height:32px;overflow:hidden'>
高
Compact Label Overflow
UX
Content
应该
Bound only unpredictable values; use nowrap with a shrinkable label; expose full text to keyboard pointer and touch users
Flexible label with min-width 0 and an operable full-value disclosure
不要
Let one compact label wrap to a second line or use a hover-only tooltip
Fixed-width badge wraps to second line or clips with title-only recovery
高
Contextual Live Badge Updates
UX
Accessibility
Web
应该
Use one appropriate atomic status message such as 3 items in cart
<span role='status' aria-atomic='true'>3 items in cart</span>
不要
Announce a bare number or make every badge a competing live region
<span aria-live='polite'>3</span>
高
Cancellable State Transitions
UX
Animation
Web
应该
Cancel or replace prior motion; set the final semantic state directly and handle cancellation cleanup
previous?.cancel(); setSelected(next)
不要
Depend on animationend or transitionend for required state correctness
Enable the chip only inside transitionend
高
Role & Traits
Web
Accessibility
iOS/Android/React Native
应该
Use accessibilityRole/button/link/checkbox etc.
<Pressable accessibilityRole="button">Submit</Pressable>
不要
Rely on generic views with no roles
<View onTouchStart={submit}>Submit</View>
高
Gesture Conflicts
Web
Touch
iOS/Android/React Native
应该
Reserve horizontal swipes for carousels
HorizontalPager inside vertical ScrollView
不要
Full-screen custom swipe conflicting with back
PanResponder on full screen blocking back
高
Modal Escape
Web
Navigation
iOS/Android/React Native
应该
Provide close button and swipe-down where platform expects
<Modal><Button title="Close" onPress={onClose} /></Modal>
不要
Trapping users in modal with no obvious exit
<Modal><View>{children}</View></Modal>
高
Loading Indicators
Web
Feedback
iOS/Android/React Native
应该
Use ActivityIndicator or skeleton for >300ms operations
{loading ? <ActivityIndicator /> : <Button title="Save" />}
不要
Leave button and screen frozen
"<Button title=""Save"" onPress={submit} /> // no loading"
高
Error Feedback
Web
Feedback
iOS/Android/React Native
应该
input-level error + summary banner
<TextInput ... /><Text style={{color:'red'}}>{error}</Text>
不要
Only change border color with no explanation
<TextInput style={{borderColor:'red'}} />
高
Virtualize Long Lists
Web
Performance
iOS/Android/React Native
应该
Use keyExtractor and initialNumToRender appropriately
<FlatList data={items} renderItem={...} />
不要
Render hundreds of items with ScrollView
<ScrollView>{items.map(renderItem)}</ScrollView>
高
Base Font Size
Web
Typography
iOS/Android/React Native
应该
Use platform fontScale and at least 14–16pt base
<Text style={{ fontSize: 16 }}>Body</Text>
不要
Render critical text below 12pt
<Text style={{ fontSize: 10 }}>Body</Text>
高
Dynamic Type Support
Web
Typography
iOS/Android/React Native
应该
Set allowFontScaling and test large text
<Text allowFontScaling>{label}</Text>
不要
Disable scaling on all text globally
<Text allowFontScaling={false}>{label}</Text>
高
Safe Area Insets
Web
Safe Areas
iOS/Android/React Native
应该
Wrap screens in SafeAreaView or apply insets
<SafeAreaView style={{ flex: 1 }}><Screen /></SafeAreaView>
不要
Place tappable content under system bars
<View style={{ flex: 1 }}><Screen /></View>
高
Light/Dark Contrast
Web
Theming
iOS/Android/React Native
应该
Use semantic tokens and test both themes
colors.textPrimaryDark = '#F9FAFB'
不要
Reuse light-theme grays directly in dark mode
colors.textPrimaryDark = '#9CA3AF' on '#111827'
高
Dragging Alternatives
Web
Accessibility
iOS/Android/React Native
应该
Provide named Move up/down buttons or a position menu beside drag handles; route iOS and Android behavior through the runtime platform adapter
<Button title="Move up" onPress={() => moveItem(index, index - 1)} />
不要
Make drag, swipe, or a web-only pointer handler the only way to reorder native content
<DragHandle /> only
中高
SWR Deduplication
React
Client
React/Next.js
应该
Use useSWR for client data fetching
const { data } = useSWR('/api/users', fetcher)
不要
Manual fetch in useEffect
useEffect(() => { fetch('/api/users').then(setUsers) }, [])
中高
Length Check First
React
JS Perf
React/Next.js
应该
Early return if lengths differ
if (a.length !== b.length) return true; // then compare
不要
Always run expensive comparison
a.sort().join() !== b.sort().join() // even when lengths differ
中高
toSorted Immutable
React
JS Perf
React/Next.js
应该
Use toSorted() for immutability
users.toSorted((a,b) => a.name.localeCompare(b.name))
不要
Mutate arrays with sort()
users.sort((a,b) => a.name.localeCompare(b.name)) // mutates
中
Defer Third Party
React
Bundle Size
React/Next.js
应该
Load non-critical scripts after hydration
const Analytics = dynamic(() => import('@vercel/analytics'), { ssr: false })
不要
Include analytics in main bundle
import { Analytics } from '@vercel/analytics/react'
中
Preload Intent
React
Bundle Size
React/Next.js
应该
Preload on user intent signals
onMouseEnter={() => import('./editor')}
不要
Load only on click
onClick={() => import('./editor')}
中
React.cache Dedup
React
Server
React/Next.js
应该
Wrap data fetchers with cache()
export const getUser = cache(async () => await db.user.find())
不要
Fetch same data multiple times in tree
export async function getUser() { return await db.user.find() }
中
After Non-blocking
React
Server
React/Next.js
应该
Use after() for logging/analytics
after(async () => { await logAction() }); return Response.json(data)
不要
Block response for non-critical operations
await logAction(); return Response.json(data)
中
Defer State Reads
React
Rerender
React/Next.js
应该
Read state on-demand in callbacks
const handleClick = () => { const params = new URLSearchParams(location.search) }
不要
Subscribe to state used only in handlers
const params = useSearchParams(); const handleClick = () => { params.get('ref') }
中
Memoized Components
React
Rerender
React/Next.js
应该
Extract to memo() components
const UserAvatar = memo(({ user }) => ...); if (loading) return <Skeleton />
不要
Compute expensive values before early return
const avatar = useMemo(() => compute(user)); if (loading) return <Skeleton />
中
Derived State
React
Rerender
React/Next.js
应该
Use derived boolean state
const isMobile = useMediaQuery('(max-width: 767px)')
不要
Subscribe to continuous values
const width = useWindowWidth(); const isMobile = width < 768
中
Functional setState
React
Rerender
React/Next.js
应该
Use functional form: setState(curr => ...)
setItems(curr => [...curr, newItem])
不要
Reference state directly in setState
setItems([...items, newItem]) // items in deps
中
Lazy State Init
React
Rerender
React/Next.js
应该
Use function form for expensive init
useState(() => buildSearchIndex(items))
不要
Compute expensive value directly
useState(buildSearchIndex(items)) // runs every render
中
Transitions
React
Rerender
React/Next.js
应该
Use startTransition for non-urgent updates
startTransition(() => setScrollY(window.scrollY))
不要
Block UI on every state change
setScrollY(window.scrollY) // blocks on every scroll
中
Hydration No Flicker
React
Rendering
React/Next.js
应该
Inject sync script for client-only values
<script dangerouslySetInnerHTML={{ __html: 'el.className = localStorage.theme' }} />
不要
Use useEffect causing flash
useEffect(() => setTheme(localStorage.theme), []) // flickers
中
Activity Component
React
Rendering
React/Next.js
应该
Use Activity for expensive toggle components
<Activity mode={isOpen ? 'visible' : 'hidden'}><Menu /></Activity>
不要
Unmount/remount on visibility toggle
{isOpen && <Menu />} // loses state
中
Batch DOM CSS
React
JS Perf
React/Next.js
应该
Use class toggle or cssText
element.classList.add('highlighted')
不要
Change styles one property at a time
el.style.width='100px'; el.style.height='200px'
中
Cache Function Results
React
JS Perf
React/Next.js
应该
Use Map cache for repeated calls
const cache = new Map(); if (cache.has(x)) return cache.get(x)
不要
Recompute same values repeatedly
slugify(name) // called 100 times same input
中
Effect Events
React
Advanced
React/Next.js
应该
Use useEffectEvent only for non-reactive logic called from inside Effects; keep real reactive dependencies
const onConnected = useEffectEvent(() => notify(theme)); useEffect(() => { connection.on('connected', onConnected) }, [roomId])
不要
Use Effect Events to hide dependencies or call them from render or ordinary event handlers
useEffect(() => connect(roomId, theme), [roomId]) // hides reactive theme use
中
Sticky Navigation
UX
Navigation
Web
应该
Add padding-top to body equal to nav height
pt-20 (if nav is h-20)
不要
Let nav overlap first section content
No padding compensation
中
Active State
UX
Navigation
应该
Highlight active nav item with color/underline
text-primary border-b-2
不要
No visual feedback on current location
All links same style
中
Deep Linking
UX
Navigation
应该
Update URL on state/view changes
Use query params or hash
不要
Static URLs for dynamic content
Single URL for all states
中
Duration Timing
UX
Animation
应该
Use shared motion tokens and test that feedback stays responsive
transition-colors duration-200
不要
Present 150-300ms or any cutoff as a universal requirement
One duration copied to every transition
中
Continuous Animation
UX
Animation
应该
Use for loading indicators only
animate-spin on loader
不要
Use for decorative elements
animate-bounce on icons
中
Transform Performance
UX
Animation
Web
应该
Use transform and opacity for animations
transform: translateY()
不要
Animate width/height/top/left properties
top: 10px animation
中
Overflow Hidden
UX
Layout
Web
应该
Test all content fits within containers
overflow-auto with scroll
不要
Blindly apply overflow-hidden
overflow-hidden truncating content
中
Fixed Positioning
UX
Layout
Web
应该
Account for safe areas and other fixed elements
Fixed nav + fixed bottom with gap
不要
Stack multiple fixed elements carelessly
Multiple overlapping fixed elements
中
Stacking Context
UX
Layout
Web
应该
Understand what creates new stacking context
Parent with z-index isolates children
不要
Expect z-index to work across contexts
z-index: 9999 not working
中
Viewport Units
UX
Layout
Web
应该
Use dvh or account for mobile browser chrome
min-h-dvh or min-h-screen
不要
Use 100vh for full-screen mobile layouts
h-screen on mobile
中
Container Width
UX
Layout
Web
应该
Limit max-width for text content (65-75ch)
max-w-prose or max-w-3xl
不要
Let text span full viewport width
Full width paragraphs
中
Touch Spacing
UX
Touch
Mobile
应该
Minimum 8px gap between touch targets
gap-2 between buttons
不要
Tightly packed clickable elements
gap-0 or gap-1
中
Gesture Conflicts
UX
Touch
Mobile
应该
Avoid horizontal swipe on main content
Vertical scroll primary
不要
Override system gestures
Horizontal swipe carousel only
中
Tap Delay
UX
Touch
Mobile
应该
Use touch-action CSS or fastclick
touch-action: manipulation
不要
Default mobile tap handling
No touch optimization
中
Hover States
UX
Interaction
Web
应该
Change cursor and add subtle visual change
hover:bg-gray-100 cursor-pointer
不要
No hover feedback on clickable elements
No hover style
中
Active States
UX
Interaction
应该
Add pressed/active state visual change
active:scale-95
不要
No feedback during interaction
No active state
中
Disabled States
UX
Interaction
应该
Reduce opacity and change cursor
opacity-50 cursor-not-allowed
不要
Confuse disabled with normal state
Same style as enabled
中
Success Feedback
UX
Interaction
应该
Show success message or visual change
Toast notification or checkmark
不要
No confirmation of completed action
Action completes silently
中
Heading Hierarchy
UX
Accessibility
Web
应该
Use sequential heading levels h1-h6
h1 then h2 then h3
不要
Skip heading levels or misuse for styling
h1 then h4
中
Screen Reader
UX
Accessibility
应该
Use semantic HTML and ARIA properly
<nav> <main> <article>
不要
Div soup with no semantics
<div> for everything
中
Skip Links
UX
Accessibility
Web
应该
Provide skip to main content link
Skip to main content link
不要
No skip link on nav-heavy pages
100 tabs to reach content
中
Lazy Loading
UX
Performance
应该
Lazy load below-fold images and content
loading='lazy'
不要
Load everything upfront
All images eager load
中
Code Splitting
UX
Performance
Web
应该
Split code by route/feature
dynamic import()
不要
Single large bundle
All code in main bundle
中
Caching
UX
Performance
Web
应该
Set appropriate cache headers
Cache-Control headers
不要
No caching strategy
Every request hits server
中
Font Loading
UX
Performance
Web
应该
Use font-display swap or optional
font-display: swap
不要
Invisible text during font load
FOIT (Flash of Invisible Text)
中
Third Party Scripts
UX
Performance
Web
应该
Load non-critical scripts async/defer
async or defer attribute
不要
Synchronous third-party scripts
<script src='...'> in head
中
Bundle Size
UX
Performance
Web
应该
Monitor and minimize bundle size
Bundle analyzer
不要
Ignore bundle size growth
No size monitoring
中
Render Blocking
UX
Performance
Web
应该
Inline critical CSS defer non-critical
Critical CSS inline
不要
Large blocking CSS files
All CSS in head
中
Inline Validation
UX
Forms
应该
Validate on blur for most fields
onBlur validation
不要
Validate only on submit
Submit-only validation
中
Input Types
UX
Forms
应该
Use email tel number url etc
type='email'
不要
Text input for everything
type='text' for email
中
Autofill Support
UX
Forms
Web
应该
Use autocomplete attribute properly
autocomplete='email'
不要
Block or ignore autofill
autocomplete='off' everywhere
中
Required Indicators
UX
Forms
应该
Use asterisk or (required) text
* required indicator
不要
No indication of required fields
Guess which are required
中
Password Visibility
UX
Forms
应该
Toggle to show/hide password
Show/hide password button
不要
No visibility toggle
Password always hidden
中
Input Affordance
UX
Forms
应该
Use distinct input styling
Border/background on inputs
不要
Inputs that look like plain text
Borderless inputs
中
Mobile Keyboards
UX
Forms
Mobile
应该
Use inputmode attribute
inputmode='numeric'
不要
Default keyboard for all inputs
Text keyboard for numbers
中
Mobile First
UX
Responsive
Web
应该
Start with mobile styles then add breakpoints
Default mobile + md: lg: xl:
不要
Desktop-first causing mobile issues
Desktop default + max-width queries
中
Breakpoint Testing
UX
Responsive
Web
应该
Test at 320 375 414 768 1024 1440
Multiple device testing
不要
Only test on your device
Single device development
中
Image Scaling
UX
Responsive
Web
应该
Use max-width: 100% on images
max-w-full h-auto
不要
Fixed width images overflow
width='800' fixed
中
Table Handling
UX
Responsive
Web
应该
Use horizontal scroll or card layout
overflow-x-auto wrapper
不要
Wide tables breaking layout
Table overflows viewport
中
Line Height
UX
Typography
应该
Use 1.5-1.75 for body text
leading-relaxed (1.625)
不要
Cramped or excessive line height
leading-none (1)
中
Line Length
UX
Typography
Web
应该
Limit to 65-75 characters per line
max-w-prose
不要
Full-width text on large screens
Full viewport width text
中
Font Size Scale
UX
Typography
应该
Use consistent modular scale
Type scale (12 14 16 18 24 32)
不要
Random font sizes
Arbitrary sizes
中
Font Loading
UX
Typography
Web
应该
Reserve space with fallback font
font-display: swap + similar fallback
不要
Layout shift when fonts load
No fallback font
中
Heading Clarity
UX
Typography
应该
Clear size/weight difference
Bold + larger size
不要
Headings similar to body text
Same size as body
中
Empty States
UX
Feedback
应该
Show helpful message and action
No items yet. Create one!
不要
Blank empty screens
Empty white space
中
Error Recovery
UX
Feedback
应该
Provide clear next steps
Try again button + help link
不要
Error without recovery path
Error message only
中
Progress Indicators
UX
Feedback
应该
Step indicators or progress bar
Step 2 of 4 indicator
不要
No indication of progress
No step information
中
Toast Notifications
UX
Feedback
应该
Auto-dismiss after 3-5 seconds
Auto-dismiss toast
不要
Toasts that never disappear
Persistent toast
中
Confirmation Messages
UX
Feedback
应该
Brief success message
Saved successfully toast
不要
Silent success
No confirmation
中
Truncation
UX
Content
应该
Truncate with ellipsis and expand option
line-clamp-2 with expand
不要
Overflow or broken layout
Overflow or cut off
中
User Freedom
UX
Onboarding
应该
Provide Skip and Back buttons
Skip Tutorial button
不要
Force linear unskippable tour
Locked overlay until finished
中
Autocomplete
UX
Search
Web
应该
Show predictions as user types
Debounced fetch + dropdown
不要
Require full type and enter
No suggestions
中
No Results
UX
Search
Web
应该
Show 'No results' with suggestions
Try searching for X instead
不要
Blank screen or '0 results'
No results found.
中
Streaming
UX
AI Interaction
应该
Stream text response token by token
Typewriter effect
不要
Show loading spinner for 10s+
Spinner until 100% complete
中
Depth Layering
UX
Spatial UI
VisionOS
应该
Use glass material and z-offset
.glassBackgroundEffect()
不要
Flat opaque panels blocking view
bg-white
中
Auto-Play Video
UX
Sustainability
Web
应该
Prefer click-to-play; provide pause and captions; stop off-screen and honor reduced motion
<video controls preload="none"><track kind="captions" /></video>
不要
Auto-play high-resolution loops without pause or captions
autoplay loop
中
Asset Weight
UX
Sustainability
Web
应该
Compress and lazy load 3D models
Draco compression
不要
Load 50MB textures
Raw .obj files
中
Focus Not Obscured (Enhanced)
UX
Accessibility
Web
应该
Keep the entire focused component unobscured by author-created content
close persistent overlay before focus moves behind it
不要
Present this enhanced AAA criterion as an AA requirement or allow persistent UI to hide any part of focus
sticky footer covers half the focused button
中
Focus Appearance
UX
Accessibility
Web
应该
Use an indicator at least as large as a 2 CSS px perimeter with 3:1 state contrast
outline: 2px solid currentColor; outline-offset: 2px
不要
Present this enhanced AAA criterion as an AA requirement or use a thin low-contrast outline
box-shadow: 0 0 1px low-contrast
中
Consistent Help
UX
Accessibility
应该
Keep contact self-help and automated help in consistent locations
shared header help menu
不要
Move help controls to different locations on each page
page-specific help placement
中
Redundant Entry
UX
Forms
应该
Auto-populate prior values or let users select previously entered information
reuse confirmed shipping address
不要
Ask users to retype the same address or account data without necessity
repeat full address form
中
Heading Line Balance
UX
Typography
Web
应该
Bound the measure and test natural-wrap fallback across widths fonts and locales
.hero-title { max-inline-size: 20ch; text-wrap: balance; }
不要
Promise an exact final line or insert blanket nonbreaking spaces or hardcoded br tags
Heading copy rewritten with forced last-line breaks
中
Dynamic Updates
Web
Accessibility
iOS/Android/React Native
应该
Use accessibilityLiveRegion or announceForAccessibility
<Text accessibilityLiveRegion="polite">{status}</Text>
不要
Update text silently with no announcement
<Text>{status}</Text>
中
Decorative Icons
Web
Accessibility
iOS/Android/React Native
应该
Mark decorative icons as not accessible
<Icon accessible={false} importantForAccessibility="no" />
不要
Have screen reader read every icon
<Icon />
中
Touch Spacing
Web
Touch
iOS/Android/React Native
应该
Keep at least 8dp spacing between touchables
<View style={{ gap: 8 }}><Button ... /><Button ... /></View>
不要
Cluster many buttons with no gap
<View><Button ... /><Button ... /></View>
中
Bottom Tabs
Web
Navigation
iOS/Android/React Native
应该
Use 3–5 tabs and move extras to More/Settings
Home/Explore/Profile/Settings
不要
Overloaded tab bar with many icons
Home/Explore/Shop/Cart/Profile/Settings/More
中
Preserve Screen State
Web
State
iOS/Android/React Native
应该
Keep components mounted or persist state
<Tab.Navigator screenOptions={{ unmountOnBlur: false }}>
不要
Reset list scroll and form inputs on every visit
<Tab.Screen options={{ unmountOnBlur: true }} />
中
Success Feedback
Web
Feedback
iOS/Android/React Native
应该
Show toast/checkmark or banner
showToast('Saved successfully')
不要
Complete actions silently with no confirmation
// silently update state only
中
Inline Validation
Web
Forms
iOS/Android/React Native
应该
Validate onBlur and onSubmit
onBlur={() => validateEmail(value)}
不要
Validate on every keystroke causing jank
onChangeText={v => validateEmail(v)} // every char
中
Keyboard Type
Web
Forms
iOS/Android/React Native
应该
Match email/tel/number/search types
<TextInput keyboardType="email-address" />
不要
Use default keyboard for all inputs
<TextInput keyboardType="default" />
中
Password Visibility
Web
Forms
iOS/Android/React Native
应该
Provide Show/Hide icon toggling secureTextEntry
<TextInput secureTextEntry={secure} /><Icon onPress={toggle} />
不要
Force users to type blind with no option
<TextInput secureTextEntry /> // no toggle
中
Image Size & Cache
Web
Performance
iOS/Android/React Native
应该
Use Image component with proper resizeMode and caching
<Image source={{uri}} resizeMode="cover" />
不要
Load full-resolution images everywhere
<Image source={require('4k.png')} /> // small avatar
中
Debounce High-Freq Events
Web
Performance
iOS/Android/React Native
应该
Wrap handlers with debounce/throttle
onScroll={debouncedHandleScroll}
不要
Run heavy logic on every event
onScroll={handleScrollHeavy}
中
Duration & Easing
Web
Animation
iOS/Android/React Native
应该
Use ease-out for enter/ease-in for exit
Animated.timing(..., { duration: 200, easing: Easing.out(Easing.quad) })
不要
Use long or linear animations for core UI
Animated.timing(..., { duration: 800, easing: Easing.linear })
中
Limited Continuous Motion
Web
Animation
iOS/Android/React Native
应该
Use looping only where necessary
Animated.loop(loaderAnim) for ActivityIndicator
不要
Keep decorative elements looping forever
Animated.loop(bounceAnim) on background icons
中低
Index Map Lookup
React
JS Perf
React/Next.js
应该
Build index Map for O(1) lookups
const byId = new Map(users.map(u => [u.id, u])); byId.get(id)
不要
Use .find() in loops
users.find(u => u.id === order.userId) // O(n) each time
中低
Cache Property Access
React
JS Perf
React/Next.js
应该
Cache values before loops
const val = obj.config.settings.value; for (...) process(val)
不要
Access nested properties in loops
for (...) process(obj.config.settings.value)
中低
Cache Storage API
React
JS Perf
React/Next.js
应该
Cache storage reads in Map
if (!cache.has(key)) cache.set(key, localStorage.getItem(key))
不要
Read storage on every call
localStorage.getItem('theme') // every call
中低
Combine Iterations
React
JS Perf
React/Next.js
应该
Single loop for multiple categorizations
for (u of users) { if (u.isAdmin) admins.push(u); if (u.isTester) testers.push(u) }
不要
Chain multiple filter() calls
users.filter(admin); users.filter(tester); users.filter(inactive)
中低
Early Return
React
JS Perf
React/Next.js
应该
Return immediately on first error
for (u of users) { if (!u.email) return { error: 'Email required' } }
不要
Process all items then check errors
let hasError; for (...) { if (!email) hasError=true }; if (hasError)...
中低
Hoist RegExp
React
JS Perf
React/Next.js
应该
Hoist RegExp to module scope
const EMAIL_RE = /^[^@]+@[^@]+$/; function validate() { EMAIL_RE.test(x) }
不要
Create RegExp every render
function C() { const re = new RegExp(pattern); re.test(x) }
中低
Set Map Lookups
React
JS Perf
React/Next.js
应该
Convert to Set for membership checks
const allowed = new Set(['a','b']); allowed.has(id)
不要
Use .includes() for repeated checks
const allowed = ['a','b']; allowed.includes(id)
低
Event Listener Dedup
React
Client
React/Next.js
应该
Use useSWRSubscription for shared listeners
useSWRSubscription('global-keydown', () => { window.addEventListener... })
不要
Register listener per component instance
useEffect(() => { window.addEventListener('keydown', handler) }, [])
低
Narrow Dependencies
React
Rerender
React/Next.js
应该
Use primitive values in dependency arrays
useEffect(() => { console.log(user.id) }, [user.id])
不要
Use object references as dependencies
useEffect(() => { console.log(user.id) }, [user])
低
SVG Animation Wrapper
React
Rendering
React/Next.js
应该
Animate div wrapper around SVG
<div class='animate-spin'><svg>...</svg></div>
不要
Animate SVG element directly
<svg class='animate-spin'>...</svg>
低
Hoist Static JSX
React
Rendering
React/Next.js
应该
Hoist static elements to module scope
const skeleton = <div class='animate-pulse' />; function C() { return skeleton }
不要
Create static elements inside components
function C() { return <div class='animate-pulse' /> }
低
Conditional Render
React
Rendering
React/Next.js
应该
Use explicit ternary for conditionals
{count > 0 ? <Badge>{count}</Badge> : null}
不要
Use && with potentially falsy numbers
{count && <Badge>{count}</Badge>} // renders '0'
低
Loop Min Max
React
JS Perf
React/Next.js
应该
Single pass loop for min/max
let max = arr[0]; for (x of arr) if (x > max) max = x
不要
Sort array to find min/max
arr.sort((a,b) => b-a)[0] // O(n log n)
低
Latest Value Refs
React
Advanced
React/Next.js
应该
Synchronize the ref after commit and read current from asynchronous callbacks
const valueRef = useRef(value); useEffect(() => { valueRef.current = value }, [value]); setTimeout(() => use(valueRef.current), 0)
不要
Mutate ref.current during render or use refs to bypass reactive dependencies
valueRef.current = value // render-phase mutation
低
Breadcrumbs
UX
Navigation
Web
应该
Use for sites with 3+ levels of depth
Home > Category > Product
不要
Use for flat single-level sites
Only on deep nested pages
低
Easing Functions
UX
Animation
应该
Use deceleration when arriving acceleration when leaving and linear for constant-rate progress
ease-out for entry; linear for spinner
不要
Reject linear easing even for steady rotation or progress
ease-in-out for every motion
低
Pull to Refresh
UX
Touch
Mobile
应该
Disable where not needed
overscroll-behavior: contain
不要
Enable by default everywhere
Default overscroll
低
Haptic Feedback
UX
Touch
Mobile
应该
Use for confirmations and important actions
navigator.vibrate(10)
不要
Overuse vibration feedback
Vibrate on every tap
低
Date Formatting
UX
Content
应该
Use relative or locale-aware dates
2 hours ago or locale format
不要
Ambiguous date formats
01/02/03
低
Number Formatting
UX
Content
应该
Use thousand separators or abbreviations
1.2K or 1,234
不要
Long unformatted numbers
1234567
低
Placeholder Content
UX
Content
应该
Use realistic sample data
Real sample content
不要
Lorem ipsum everywhere
Lorem ipsum
低
Bulk Actions
UX
Data Entry
Web
应该
Allow multi-select and bulk edit
Checkbox column + Action bar
不要
Single row actions only
Repeated actions per row
低
Feedback Loop
UX
AI Interaction
应该
Thumps up/down or 'Regenerate'
Feedback component
不要
Static output only
Read-only text
低
Auto Focus & Next
Web
Forms
iOS/Android/React Native
应该
Use onSubmitEditing to focus next input
onSubmitEditing={() => nextRef.current?.focus()}
不要
Force users to tap each field manually
// no onSubmitEditing, manual tap only