- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2k
 
fix(codeblock): codeblock flickering issue #5849
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
          
 | 
    
| 
           @villAsh is attempting to deploy a commit to the HeroUI Inc Team on Vercel. A member of the Team first needs to authorize it.  | 
    
          
WalkthroughRemoved the  Changes
 Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 
 Suggested reviewers
 Pre-merge checks and finishing touches❌ Failed checks (1 warning)
 ✅ Passed checks (2 passed)
 ✨ Finishing touches
 🧪 Generate unit tests (beta)
 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
 🚧 Files skipped from review as they are similar to previous changes (1)
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment   | 
    
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/docs/components/docs/components/codeblock.tsx (1)
103-106: Remove commented code and clarify the explanatory comment.The commented line 106 shows invalid code (
width: "w-full"where "w-full" is a Tailwind class, not a CSS value) that should be removed entirely. Additionally, the comment on lines 103-105 describes the old flickering behavior but may confuse readers since it referencesdisplay: contentswhich is no longer present in the code.Consider this cleanup:
- style={{ - height: isVisible ? "auto" : `${height}px`, - // due to display: contents on the scrollable child element, this div will also scroll - // this causes the intersection observer to trigger if scrolled far enough horizontally - // set the width to fit-content to prevent this div from going off screen - // width: "w-full", - }} + style={{ + height: isVisible ? "auto" : `${height}px`, + }}
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/docs/components/docs/components/codeblock.tsx(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/docs/components/docs/components/codeblock.tsx (1)
packages/core/react/src/scripts/postbuild.js (1)
style(56-56)
🔇 Additional comments (2)
apps/docs/components/docs/components/codeblock.tsx (2)
132-137: LGTM: Correct overflow handling for horizontal scrolling.The addition of
overflow-x-autoon the pre element, combined withoverflow-hiddenon the parent container, properly isolates scrolling behavior and resolves the flickering issue.
139-144: LGTM: Explicit display and whitespace properties ensure correct code rendering.Setting
display: "block"andwhiteSpace: "pre"explicitly guarantees proper block-level layout and whitespace preservation for the code block, regardless of inherited or theme-provided styles.
          
@heroui/accordion
 @heroui/alert
 @heroui/autocomplete
 @heroui/avatar
 @heroui/badge
 @heroui/breadcrumbs
 @heroui/button
 @heroui/calendar
 @heroui/card
 @heroui/checkbox
 @heroui/chip
 @heroui/code
 @heroui/date-input
 @heroui/date-picker
 @heroui/divider
 @heroui/drawer
 @heroui/dropdown
 @heroui/form
 @heroui/image
 @heroui/input
 @heroui/input-otp
 @heroui/kbd
 @heroui/link
 @heroui/listbox
 @heroui/menu
 @heroui/modal
 @heroui/navbar
 @heroui/number-input
 @heroui/pagination
 @heroui/popover
 @heroui/progress
 @heroui/radio
 @heroui/ripple
 @heroui/scroll-shadow
 @heroui/select
 @heroui/skeleton
 @heroui/slider
 @heroui/snippet
 @heroui/spacer
 @heroui/spinner
 @heroui/switch
 @heroui/table
 @heroui/tabs
 @heroui/toast
 @heroui/tooltip
 @heroui/user
 @heroui/react
 @heroui/system
 @heroui/system-rsc
 @heroui/theme
 @heroui/use-aria-accordion
 @heroui/use-aria-accordion-item
 @heroui/use-aria-button
 @heroui/use-aria-link
 @heroui/use-aria-modal-overlay
 @heroui/use-aria-multiselect
 @heroui/use-aria-overlay
 @heroui/use-callback-ref
 @heroui/use-clipboard
 @heroui/use-data-scroll-overflow
 @heroui/use-disclosure
 @heroui/use-draggable
 @heroui/use-form-reset
 @heroui/use-image
 @heroui/use-infinite-scroll
 @heroui/use-intersection-observer
 @heroui/use-is-mobile
 @heroui/use-is-mounted
 @heroui/use-measure
 @heroui/use-pagination
 @heroui/use-real-shape
 @heroui/use-ref-state
 @heroui/use-resize
 @heroui/use-safe-layout-effect
 @heroui/use-scroll-position
 @heroui/use-ssr
 @heroui/use-theme
 @heroui/use-update-effect
 @heroui/use-viewport-size
 @heroui/aria-utils
 @heroui/dom-animation
 @heroui/framer-utils
 @heroui/react-rsc-utils
 @heroui/react-utils
 @heroui/shared-icons
 @heroui/shared-utils
 @heroui/stories-utils
 @heroui/test-utils
 commit:   | 
    
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.
I think most of the changes are not really required. Not sure if I've missed something. Could you please explain them line by line?
| 
           @wingkwong, I get it, I'll revert a few changes and see if it works or not.  | 
    
| 
           @wingkwong updated, please check.  | 
    
Closes Issue
📝 Description
When scrolling inside the Code tab of the any component section on the documentation page, the content flickers or flashes repeatedly.
⛳️ Current behavior (updates)
It does not allows users to scroll smoothly.
🚀 New behavior
The code block now scroll smoothly with no flickering or repaint artifacts.
💣 Is this a breaking change (Yes/No):
No
codeblock-flickering-issue-solved.mov
📝 Additional Information
Summary by CodeRabbit
Bug Fixes
Style