mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 14:19:01 +02:00
Merge pull request #3159 from overleaf/ta-outline-item-scroll-fix
Fix Outline Item Scroll for Highlighted Parents GitOrigin-RevId: e67ca4a3043cd60536dbd389438b5a67d6f38efa
This commit is contained in:
@@ -55,18 +55,16 @@ function OutlineItem({ outlineItem, jumpToLine, highlightedLine }) {
|
||||
useEffect(
|
||||
() => {
|
||||
const wasHighlighted = isHighlightedRef.current
|
||||
const isNowHighlighted = highlightedLine === outlineItem.line
|
||||
isHighlightedRef.current = isHighlighted
|
||||
|
||||
isHighlightedRef.current = isNowHighlighted
|
||||
|
||||
if (!wasHighlighted && isNowHighlighted) {
|
||||
if (!wasHighlighted && isHighlighted) {
|
||||
scrollIntoViewIfNeeded(titleElementRef.current, {
|
||||
scrollMode: 'if-needed',
|
||||
block: 'center'
|
||||
})
|
||||
}
|
||||
},
|
||||
[highlightedLine, titleElementRef, isHighlightedRef]
|
||||
[isHighlighted, titleElementRef, isHighlightedRef]
|
||||
)
|
||||
|
||||
// don't set the aria-expanded attribute when there are no children
|
||||
|
||||
Reference in New Issue
Block a user