Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iabookreader with IIIF Manifest V3 fails to highlight when search term is passed via URL #445

Open
DiegoPino opened this issue Apr 23, 2024 · 1 comment
Assignees
Labels
bug Something isn't working Field Formatter The thing that glues the pieces and adds glitter IIIF Specs/Manifests/Implementations Javascript Favourite language of a PHP developer UX Like UI but with an X
Milestone

Comments

@DiegoPino
Copy link
Member

DiegoPino commented Apr 23, 2024

What?

New to me.

Was testing the IABookreader behavior today and noticed that, when IIIF Manifest V3 with page/individual hints is loaded the URL fragment (#search/someword) is ignored. This does not happen on a Manifest V2.

Not clear yet what/how this is happening but it might be related to how the default mode (the /mode/) is being added when a paging hint is found, not taking in account any previous passed /search. This is JS.

@alliomeria will ask to replicate. Kinda a biggie bc people love their highlights

Update. This happens not only on V3. It is related to how URL based manifests are being parsed (when using an exposed endpoint) and when that happens, how the https://github.com/internetarchive/bookreader/blob/master/src/plugins/plugin.resume.js plugin kicks in sooner replacing anything passed via a cookie content.
Options are:

  • Override it?
  • Allow users to disable it?
  • Make resume aware of a search?

I never liked the resume one to be honest....

@DiegoPino DiegoPino self-assigned this Apr 23, 2024
@DiegoPino DiegoPino added bug Something isn't working Javascript Favourite language of a PHP developer IIIF Specs/Manifests/Implementations Field Formatter The thing that glues the pieces and adds glitter UX Like UI but with an X labels Apr 23, 2024
@DiegoPino DiegoPino added this to the 1.4.0 milestone Apr 23, 2024
@DiegoPino
Copy link
Member Author

I figured out the issue. The URL processing Plugin is tied (race condition + bad code) to having Bookreader setup and init running almost at the same time/sequentially and blocking (there is a timed event listener). So when the manifest is being fetched async (so there is a wait) the URL Plugin that reads the fragment acts sooner + loses context (the "this" in JS in no longer in scope) and defaults to the saved cookie with the lasted/previous visit to a book.
The solution is to force the "defaults" when the Manifests ends loading by processing ourselves the fragment we saw while fetching the data, modifying it to match the desired/manifest level mode.
This opens the opportunity to make the fragment loading a function we manage (that works for this, heavily inspired in Bookreader) so I can call it also on OSD/Mirador and use that to allow links leading to search on both

Lots of work needed @alliomeria @patdunlavey but I will get it done before 2PM and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Field Formatter The thing that glues the pieces and adds glitter IIIF Specs/Manifests/Implementations Javascript Favourite language of a PHP developer UX Like UI but with an X
Projects
None yet
Development

No branches or pull requests

1 participant