Open calixteman opened 1 year ago
Before attempting any further work on this method, I think that we need to add a bunch of e.g. integration-tests such that we're able to better catch any regressions since this code is absolutely vital to the correct function of the viewer.
This function is very prone to errors: some small variations in different places can lead to errors especially when highlighting search results. It has been added few years ago to fix: https://github.com/mozilla/pdf.js/issues/1738
scrollIntoView
moves the parent window when it should only scroll within the iframe. So we could maybe only useelement.scrollIntoView
when the viewer is not in an iframe else find a better way to compute the scroll offset (based on the page offset and on the position of the element within the page, ... something like that...).