readium-shared-js icon indicating copy to clipboard operation
readium-shared-js copied to clipboard

IndexSizeError: cfi_navigation_logic.js - findVisibleLeafNodeCfi

Open bradleygore opened this issue 9 years ago • 5 comments

This issue is a Bug

Expected Behaviour

Get the range of selected nodes and highlight them.

Observed behaviour

findVisibleLeafNodeCfi is generating this error: IndexSizeError: Index or size is negative or greater than the allowed amount

Steps to reproduce

  1. Open an epub with a fixed-layout and an image background
  2. Set breakpoint at highlights manager line 117 and if spineItem.paginationInfo isn't defined, default it to {} (see this bug for reference) 3: Select some text 4: Try to add highlight

Product

  • Readium cloud reader app
    • latest development build uploaded at https://readium.firebaseapp.com
    • Firefox 48
    • Multiple OS

Additional information

Please find a sample epub attached where we're seeing this issue. fixed_layout.epub.zip

Also, if you pull in this ePub with text overlays you can very consistently replicate the issue as follows.

NOTE: Requires same paginationInfo work-around as defined in step 2 above.

  • Navigate to a page with a full background image
  • Click on the background image for the overlay to fade in
  • Select some text in the overlay
    • This may cause overlay to fade out, just click image again to bring it back
  • Click the Highlight icon

bradleygore avatar Aug 02 '16 21:08 bradleygore

Duplicated issue? https://github.com/readium/readium-shared-js/issues/280

danielweck avatar Aug 04 '16 15:08 danielweck

No, this isn't a dup. This is the error that you'll see once #280 is fixed, as I've included the workaround for #280 in the instructions for reproducing the issue.

bradleygore avatar Aug 04 '16 15:08 bradleygore

Okay thanks for the clarification! :)

danielweck avatar Aug 04 '16 15:08 danielweck

@bradleygore I suspect that the empty paginationInfo object simply "postpones" the occurrence of the bug (because the data in paginationInfo is needed for highlights to function properly, right?). I need to run some tests too, but ultimately, paginationInfo cannot just be empty.

danielweck avatar Aug 04 '16 16:08 danielweck

@danielweck You're very likely right - I'm still trying to grok what all is going on, so could be that once the paginationInfo issue is fixed the right way, vs my poor hack around, that this will get resolved along with it :)

bradleygore avatar Aug 04 '16 16:08 bradleygore