Skip to content

Remove the unused id properties from page and thumbnail canvas/image DOM elements (issue 11499) #11503

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

Merged
merged 2 commits into from
Jan 12, 2020

Conversation

Snuffleupagus
Copy link
Collaborator

  • Remove the unused id properties from page and thumbnail canvas/image DOM elements (issue 11499)

    As described in the issue, having a DOM element with id=page2 (or any other number) will automatically cause that element to become linkable through the URL hash. That's currently leading to some confusing and outright wrong behaviour, since it obviously only works for pages that have been loaded and rendered.

    For PDF documents the only officially supported way to reference a particular page through the URL hash is using the #page=2 format, which also works for all pages regardless if they're loaded or not.

    As far as I can tell there's nothing in the PDF.js default viewer that actually depends on the page/thumbnail id at this point in time, hence why I believe that this removal ought to be safe.
    Just as a pre-caution this patch adds an aria-label to the page canvas, similar to the thumbnail canvas/image, to at least keep this information in the DOM.

  • Add helper functions to reduce unnecessary duplication when fetching l10n messages in PDFThumbnailView

Fixes #11499

…e DOM elements (issue 11499)

As described in the issue, having a DOM element with `id=page2` (or any other number) will automatically cause that element to become linkable through the URL hash. That's currently leading to some confusing and outright wrong behaviour, since it obviously only works for pages that have been loaded and rendered.

For PDF documents the only officially supported way to reference a particular page through the URL hash is using the `#page=2` format, which also works for all pages regardless if they're loaded or not.

As far as I can tell there's nothing in the PDF.js default viewer that actually depends on the page/thumbnail `id` at this point in time, hence why I believe that this removal ought to be safe.
Just as a pre-caution this patch adds an `aria-label` to the page canvas, similar to the thumbnail canvas/image, to at least keep this information in the DOM.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/fd5e495fb320c47/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/fd5e495fb320c47/output.txt

Total script time: 1.75 mins

Published

@timvandermeij timvandermeij merged commit 40f531e into mozilla:master Jan 12, 2020
@timvandermeij
Copy link
Contributor

Thank you for cleaning this up!

@Snuffleupagus Snuffleupagus deleted the issue-11499 branch January 12, 2020 18:56
MichielDG pushed a commit to MichielDG/pdf.js that referenced this pull request Jan 17, 2020
Remove the unused `id` properties from page and thumbnail canvas/image DOM elements (issue 11499)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#pageN anchor not working on first page load
3 participants