move tabindex setting to modal controls
This commit is contained in:
@ -36,7 +36,7 @@ layout: base.njk
|
|||||||
<button class="close-dialog" autofocus aria-label="close the image modal">×</button>
|
<button class="close-dialog" autofocus aria-label="close the image modal">×</button>
|
||||||
<img class="modal-img" src="/img/{{ image.src }}" alt="{{ image.alt }}">
|
<img class="modal-img" src="/img/{{ image.src }}" alt="{{ image.alt }}">
|
||||||
</dialog>
|
</dialog>
|
||||||
<img tabindex="0" class="hero" src="/img/{{ image.src }}" alt="{{ image.alt }}">
|
<img class="hero" src="/img/{{ image.src }}" alt="{{ image.alt }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ content | safe }}
|
{{ content | safe }}
|
||||||
|
|||||||
@ -4,6 +4,8 @@ if (window.innerWidth > 650) {
|
|||||||
const closeButton = document.querySelector(".close-dialog");
|
const closeButton = document.querySelector(".close-dialog");
|
||||||
const hero = document.querySelector(".hero");
|
const hero = document.querySelector(".hero");
|
||||||
|
|
||||||
|
hero.tabIndex = 0;
|
||||||
|
|
||||||
hero.addEventListener("click", (e) => dialog.showModal());
|
hero.addEventListener("click", (e) => dialog.showModal());
|
||||||
hero.addEventListener("keydown", (e) => {
|
hero.addEventListener("keydown", (e) => {
|
||||||
if (e.key === "Enter" || e.key === " ") {
|
if (e.key === "Enter" || e.key === " ") {
|
||||||
|
|||||||
Reference in New Issue
Block a user