Convert the existing overlays to use <dialog> elements (issue 14698)

This replaces our *custom* overlays with standard `<dialog>` DOM elements, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog, thus simplifying the related CSS, HTML, and JavaScript code.

With these changes, some of the functionality of the `OverlayManager` class is now handled natively (e.g. `Esc` to close the dialog). However, since we still need to be able to prevent dialogs from overlaying one another, it still makes sense to keep this functionality (as far as I'm concerned).
This commit is contained in:
Jonas Jenwald 2022-03-25 14:10:13 +01:00
parent 0dd6bc9a85
commit f0aa08b464
9 changed files with 221 additions and 272 deletions

View file

@ -1,32 +1,30 @@
<div id="chromeFileAccessOverlay" class="container hidden">
<div class="dialog">
<div class="row">
<!-- The extension icon (PDF.js logo) will be shown at the left, to help
users with recognizing which checkbox they have to click when they
visit chrome://extensions.
-->
<p id="chrome-pdfjs-logo-bg" style="
display: block;
padding-left: 60px;
min-height: 48px;
background-size: 48px;
background-repeat: no-repeat;
font-size: 14px;
line-height: 1.8em;
word-break: break-all;">
Click on
"<span id="chrome-file-access-label">Allow access to file URLs</span>"
at
<a id="chrome-link-to-extensions-page">chrome://extensions</a>
<br>
to view <span id="chrome-url-of-local-file">this PDF file.</span>
</p>
</div>
<div class="row">
<p>
or select the file again:
<input type="file" id="chrome-file-fallback" accept=".pdf">
</p>
</div>
<dialog id="chromeFileAccessDialog">
<div class="row">
<!-- The extension icon (PDF.js logo) will be shown at the left, to help
users with recognizing which checkbox they have to click when they
visit chrome://extensions.
-->
<p id="chrome-pdfjs-logo-bg" style="
display: block;
padding-left: 60px;
min-height: 48px;
background-size: 48px;
background-repeat: no-repeat;
font-size: 14px;
line-height: 1.8em;
word-break: break-all;">
Click on
"<span id="chrome-file-access-label">Allow access to file URLs</span>"
at
<a id="chrome-link-to-extensions-page">chrome://extensions</a>
<br>
to view <span id="chrome-url-of-local-file">this PDF file.</span>
</p>
</div>
</div>
<div class="row">
<p>
or select the file again:
<input type="file" id="chrome-file-fallback" accept=".pdf">
</p>
</div>
</dialog>