♿ focus management for issues
This commit is contained in:
@@ -414,6 +414,11 @@ main {
|
|||||||
background: var(--color-background);
|
background: var(--color-background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remove outline when comic image container is focused programmatically (for keyboard nav) */
|
||||||
|
.comic-image:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
.comic-image a {
|
.comic-image a {
|
||||||
display: block;
|
display: block;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@@ -124,6 +124,12 @@
|
|||||||
|
|
||||||
// Update URL without reload
|
// Update URL without reload
|
||||||
history.pushState({ comicId: comic.number }, '', `/comic/${comic.number}`);
|
history.pushState({ comicId: comic.number }, '', `/comic/${comic.number}`);
|
||||||
|
|
||||||
|
// Move focus to comic image for keyboard navigation accessibility
|
||||||
|
const comicImageFocus = document.getElementById('comic-image-focus');
|
||||||
|
if (comicImageFocus) {
|
||||||
|
comicImageFocus.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update or create comic image with optional mobile version
|
// Update or create comic image with optional mobile version
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="comic-image">
|
<div class="comic-image" id="comic-image-focus" tabindex="-1">
|
||||||
{% if comic.number < total_comics %}
|
{% if comic.number < total_comics %}
|
||||||
<a href="{{ url_for('comic', comic_id=comic.number + 1) }}">
|
<a href="{{ url_for('comic', comic_id=comic.number + 1) }}">
|
||||||
{% if comic.mobile_filename %}
|
{% if comic.mobile_filename %}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<p class="comic-date">{{ comic.date }}</p>
|
<p class="comic-date">{{ comic.date }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="comic-image">
|
<div class="comic-image" id="comic-image-focus" tabindex="-1">
|
||||||
{% if comic.mobile_filename %}
|
{% if comic.mobile_filename %}
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(max-width: 768px)" srcset="{{ url_for('static', filename='images/comics/' + comic.mobile_filename) }}">
|
<source media="(max-width: 768px)" srcset="{{ url_for('static', filename='images/comics/' + comic.mobile_filename) }}">
|
||||||
|
|||||||
Reference in New Issue
Block a user