Reduce review panel flicker in Chrome when scrolling a large document (#30812)

GitOrigin-RevId: a5f210bc9643de221913c37fbd5c9e456677d120
This commit is contained in:
Alf Eaton
2026-01-27 12:04:48 +00:00
committed by Copybot
parent 3b027a2b08
commit a82258fdf4
2 changed files with 5 additions and 6 deletions

View File

@@ -4,22 +4,19 @@ import { useCodeMirrorViewContext } from '@/features/source-editor/components/co
export const useReviewPanelStyles = () => {
const view = useCodeMirrorViewContext()
const [styles, setStyles] = useState<CSSProperties>({
'--review-panel-header-height': '36px',
} as CSSProperties)
const [styles, setStyles] = useState<CSSProperties>({} as CSSProperties)
const updateScrollDomVariables = useCallback((element: HTMLDivElement) => {
const { top, bottom } = element.getBoundingClientRect()
const { top } = element.getBoundingClientRect()
setStyles(value => ({
...value,
'--review-panel-top': `${top}px`,
'--review-panel-bottom': `${bottom}px`,
}))
}, [])
const updateContentDomVariables = useCallback((element: HTMLDivElement) => {
const { height } = element.getBoundingClientRect()
const height = element.clientHeight
setStyles(value => ({
...value,

View File

@@ -16,6 +16,7 @@ $rp-type-blue: #6b7797;
--review-panel-empty-state-bg-color: var(--bg-light-primary);
--review-panel-button-hover-bg-color: var(--bg-light-tertiary);
--review-panel-border-color: var(--border-divider);
--review-panel-header-height: 36px;
--review-panel-width: 230px;
--review-panel-width-mini: 24px;
--review-panel-color-scheme: light;
@@ -95,6 +96,7 @@ $rp-type-blue: #6b7797;
box-sizing: content-box;
width: var(--review-panel-width);
min-height: var(--review-panel-height);
backface-visibility: hidden; // force compositing layer
.dropdown-menu {
z-index: 1;