@@ -97,10 +97,11 @@ function getOutputScale(ctx) {
97
97
* @param {Object } element - The element to be visible.
98
98
* @param {Object } spot - An object with optional top and left properties,
99
99
* specifying the offset from the top left edge.
100
- * @param {boolean } skipOverflowHiddenElements - Ignore elements that have
101
- * the CSS rule `overflow: hidden;` set. The default is false.
100
+ * @param {boolean } [scrollMatches] - When scrolling search results into view,
101
+ * ignore elements that either: Contains marked content identifiers,
102
+ * or has the CSS-rule `overflow: hidden;` set. The default value is `false`.
102
103
*/
103
- function scrollIntoView ( element , spot , skipOverflowHiddenElements = false ) {
104
+ function scrollIntoView ( element , spot , scrollMatches = false ) {
104
105
// Assuming offsetParent is available (it's not available when viewer is in
105
106
// hidden iframe or object). We have to scroll: if the offsetParent is not set
106
107
// producing the error. See also animationStarted.
@@ -114,8 +115,9 @@ function scrollIntoView(element, spot, skipOverflowHiddenElements = false) {
114
115
while (
115
116
( parent . clientHeight === parent . scrollHeight &&
116
117
parent . clientWidth === parent . scrollWidth ) ||
117
- ( skipOverflowHiddenElements &&
118
- getComputedStyle ( parent ) . overflow === "hidden" )
118
+ ( scrollMatches &&
119
+ ( parent . classList . contains ( "markedContent" ) ||
120
+ getComputedStyle ( parent ) . overflow === "hidden" ) )
119
121
) {
120
122
offsetY += parent . offsetTop ;
121
123
offsetX += parent . offsetLeft ;
0 commit comments