Merge pull request #282506 from MohamedEmirHajji/enhance-isVisible-to-detect-hidden-elements-in-markdown

Markdown preview: filter hidden elements from scroll sync (fix #281247)
This commit is contained in:
Matt Bierner
2025-12-10 11:01:41 -08:00
committed by GitHub
@@ -20,7 +20,21 @@ export class CodeLineElement {
}
get isVisible(): boolean {
return !this._detailParentElements.some(x => !x.open);
if (this._detailParentElements.some(x => !x.open)) {
return false;
}
const style = window.getComputedStyle(this.element);
if (style.display === 'none' || style.visibility === 'hidden') {
return false;
}
const bounds = this.element.getBoundingClientRect();
if (bounds.height === 0 || bounds.width === 0) {
return false;
}
return true;
}
}