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

Figure callout link on entry page doesn't work if clicked a second time #948

Open
1 task done
Erin-Cecele opened this issue Aug 23, 2024 · 3 comments
Open
1 task done
Assignees
Labels
status:backlog Issue is a lower priority but needs to eventually be addressed workaround Issue has a workaround

Comments

@Erin-Cecele
Copy link
Collaborator

Before proceeding, make sure there isn’t an existing issue for this bug.

  • I have searched the existing issues and determined this is a new bug.

Expected Behavior

You should click on a figure callout, be brought down to the associated image, and be able to scroll back up and repeat this process.

Actual Behavior

The figure callout link works the first time, but if you scroll back to the callout and click it again, nothing happens. This only appears to be occurring on an object entry page.

Per @geealbers

When you click a figure callout link, the id to that figure is added to the URL in the browser bar (#fig-125b-6). If you then try to click a second instance of the link that goes to that same id, the browser already thinks it’s where it needs to be so it doesn’t go anywhere. If you instead click a link to a different figure, before clicking the fig 6 link again, it works because the URL has switched.

Steps to Reproduce

  1. create a new quire project
  2. add figure callout [Fig 1.2](#mother-annotations) somewhere in the text
  3. click the callout (you will be brought to the image)
  4. scroll back from the image to the callout and click it a second time (nothing will happen)

Version Numbers

[CLI] Command 'info' called with options { debug: true }
[test-project]
quire-cli 1.0.0-rc.14
quire-11ty 1.0.0-rc.16
starter https://github.com/thegetty/[email protected]
[System]
quire-cli 1.0.0-rc.14
node v18.17.0
npm 9.6.7
os Darwin 21.6.0

Web Browser

This is occurring in all web browsers except for Firefox

Relevant Terminal/Shell Output

No response

Supporting Information

This was brought to our attention by @zsofiaj.

@Erin-Cecele Erin-Cecele added the status:triage needed Issue needs to be triaged by the Quire team. This label is automatically applied to new issues. label Aug 23, 2024
@Erin-Cecele Erin-Cecele self-assigned this Aug 23, 2024
@1000camels
Copy link
Collaborator

I resolved it by adding window.location.hash = '#' before line 129 in content/_assets/javascript/application/index.js

It would appear Chrome and perhaps other browsers get confused when there is already an anchor in the url, so set it to nothing (or #) clears it so it works correctly. Here is some more information about this issue: https://stackoverflow.com/questions/6634773/html-anchor-works-only-once

This should probably be patched in the core, but can be adjusted in your project.

@Erin-Cecele
Copy link
Collaborator Author

Wow!! Thank you, @1000camels!! @tiffanysprague and @zsofiaj, Darcy has a solution for you!! Please confirm whether you are able to get this working on your end and we will communicate the fix to our developers.

@Erin-Cecele Erin-Cecele added status:backlog Issue is a lower priority but needs to eventually be addressed workaround Issue has a workaround and removed status:triage needed Issue needs to be triaged by the Quire team. This label is automatically applied to new issues. labels Jan 6, 2025
@zsofiaj
Copy link
Collaborator

zsofiaj commented Jan 7, 2025

Amazing, thanks so much @1000camels !! We're super grateful to have this fixed. I added that line, and the links work perfectly now. @tiffanysprague, if you want to do some testing as well, this fix is now up on the volume 2 batch 2 branch. And thank you for all your help, as always, @Erin-Cecele !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:backlog Issue is a lower priority but needs to eventually be addressed workaround Issue has a workaround
Projects
None yet
Development

No branches or pull requests

3 participants