samvera / hyku

Hyku: A multi-tenant Hyrax application built on the latest and greatest Samvera community components. Brought to you by the Hydra-in-a-Box project partners and IMLS; maintained by the Hyku Interest Group.
https://samvera.atlassian.net/wiki/spaces/hyku/overview
Other
96 stars 49 forks source link

Anchor link behavior causing automatic scroll to top of PDF.js iframe when search query params absent #2348

Open st1072 opened 1 month ago

st1072 commented 1 month ago

Descriptive summary

On Hyku v5.1.0, Chrome and other browsers automatically jump to the top of PDF.js iframe when the iframe src includes a trailing "#" (indicating an anchor link).

Screenshot 2024-09-27 at 4 08 07 PM

This "#" should only be included if search query parameters exist.

Fix applied to pdf_js_helper.rb here: https://github.com/Georgetown-University-Libraries/GU-Hyku/commit/0c650b503e6eafb2da80986a89a0b2dc365003bf

Rationale

Automatically jumping to the top of the PDF.js iframe skips masthead, navigation, work title and other content which the user may want to see first. Also, this behavior is inconsistent with the behavior of work show pages that do not contain PDF.js iframes.

Expected behavior

Chrome and other browsers render top of HTML document in viewport after loading pages with PDF.js iframes.

Actual behavior

Chrome and other browsers automatically jump to top of PDF.js iframes.