Try to follow accessibility best practices
ref https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress
This commit is contained in:
parent
4f222ffda6
commit
f28c7ace87
3 changed files with 57 additions and 23 deletions
39
README.md
39
README.md
|
@ -20,13 +20,30 @@ progress bar is removed once the delivery is complete:
|
|||
<head>
|
||||
<title>Postman</title>
|
||||
<script type="module" src="delivery.js"></script>
|
||||
<style>
|
||||
html, html body { height: 100%; }
|
||||
main.postman {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
main.postman progress {
|
||||
max-width: 200px;
|
||||
}
|
||||
main.postman .percent {
|
||||
font-family: courier;
|
||||
font-size: smaller;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="postman loader">
|
||||
<progress value="0" max="100"></progress>
|
||||
<span class="percentage"></span>
|
||||
</div>
|
||||
</div>
|
||||
<main class="postman">
|
||||
<label>
|
||||
<progress id="progress" value="0" max="100"></progress>
|
||||
</label>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
@ -36,8 +53,9 @@ progress bar is removed once the delivery is complete:
|
|||
```typescript
|
||||
import postman, { item } from "postman";
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const bar = document.querySelector("progress");
|
||||
const span = document.querySelector(".percentage");
|
||||
const postman = document.querySelector("main.postman");
|
||||
const bar = postman.querySelector("progress");
|
||||
const span = postman.querySelector(".percent");
|
||||
const delivery = postman(
|
||||
item.font("Kanit Regular", "url(/fonts/kanit-regular.ttf)"),
|
||||
item.script("/js/app.js"),
|
||||
|
@ -45,7 +63,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
item.css("/css/app.css"),
|
||||
item.progress((percent) => {
|
||||
bar.value = percent;
|
||||
span.innerText = `${percent}%`;
|
||||
bar.innerText = span.innerText = `${percent}%`;
|
||||
})
|
||||
).deliver();
|
||||
|
||||
|
@ -54,9 +72,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
package.fonts.forEach((font) => documents.fonts.add(font));
|
||||
package.scripts.forEach((script) => document.body.appendChild(script));
|
||||
package.css.forEach((css) => document.head.appendChild(css));
|
||||
/* Replace progress bar */
|
||||
bar.remove();
|
||||
span.remove();
|
||||
/* Replace loading screen */
|
||||
postman.remove();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import postman, { item } from "postman";
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const bar = document.querySelector("progress");
|
||||
const span = document.querySelector(".percentage");
|
||||
const postman = document.querySelector("main.postman");
|
||||
const bar = postman.querySelector("progress");
|
||||
const span = postman.querySelector(".percent");
|
||||
const delivery = postman(
|
||||
item.font("Kanit Regular", "url(/fonts/kanit-regular.ttf)"),
|
||||
item.script("/js/app.js"),
|
||||
|
@ -9,7 +10,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
item.css("/css/app.css"),
|
||||
item.progress((percent) => {
|
||||
bar.value = percent;
|
||||
span.innerText = `${percent}%`;
|
||||
bar.innerText = span.innerText = `${percent}%`;
|
||||
})
|
||||
).deliver();
|
||||
|
||||
|
@ -18,8 +19,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
package.fonts.forEach((font) => documents.fonts.add(font));
|
||||
package.scripts.forEach((script) => document.body.appendChild(script));
|
||||
package.css.forEach((css) => document.head.appendChild(css));
|
||||
/* Replace progress bar */
|
||||
bar.remove();
|
||||
span.remove();
|
||||
/* Replace loading screen */
|
||||
postman.remove();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,13 +2,30 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Postman</title>
|
||||
<script type="module" src="postman.js"></script>
|
||||
<script type="module" src="delivery.js"></script>
|
||||
<style>
|
||||
html, html body { height: 100%; }
|
||||
main.postman {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
main.postman progress {
|
||||
max-width: 200px;
|
||||
}
|
||||
main.postman .percent {
|
||||
font-family: courier;
|
||||
font-size: smaller;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="postman loader">
|
||||
<progress value="0" max="100"></progress>
|
||||
<span class="percentage"></span>
|
||||
</div>
|
||||
</div>
|
||||
<main class="postman">
|
||||
<label>
|
||||
<progress id="progress" value="0" max="100"></progress>
|
||||
</label>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue