fix: allow content of highlightedCode(pre tag) to scroll when overscr… #9397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
chart-code-viewer.tsxso the highlighted code area remains vertically scrollable even when the rendered<pre>usesoverscroll-none.chart.highlightedCodein an outer<div>withoverflow-y-auto/no-scrollbar, instead of relying on the injected markup to handle scrolling.pointer-events-noneandoverscroll-containto the inner div that rendersdangerouslySetInnerHTML, so scroll gestures are handled by the wrapper.Problem
The new overscroll-none css utility causes a scrolling issue in the code preview on https://ui.shadcn.com/charts/bar#charts when clicking the View code button on any chart, and the code preview area(highlighted markup) can no longer be scrolled.
The highlighted markup is generated by highlightCode in apps/v4/lib/highlight-code.ts, which (via a recent change) adds
overscroll-noneto the rendered<pre>.Any chart component that uses highlightCode and passes the result into
ChartCodeViewerwould reproduce the “can’t scroll code” bug.Changes
apps/v4/components/chart-code-viewer.tsx
Test Plan
[ ] verify the scrolling issue is fixed