fix: various accessibility issues

This commit is contained in:
Ayo Ayco 2024-04-26 17:55:05 +02:00
parent eff0011fc3
commit df6e1e2ffd

View file

@ -1,21 +1,23 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ app.title }}</title> <title>{{ app.title }}</title>
<link rel="stylesheet" href="https://webcomponent.io/reset.css" /> <link rel="stylesheet" href="https://webcomponent.io/reset.css" />
<style> <style>
body { body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
max-width: 570px; max-width: 600px;
margin: 0 auto; margin: 0 auto;
color: #232323; color: #232323;
padding: 5px; padding: 5px;
} }
header, footer, main {
padding: 1em;
}
header, footer { header, footer {
background: linear-gradient(45deg, #3054bf, #416fff); background: linear-gradient(45deg, #3054bf, #416fff);
padding: 1em;
color: white; color: white;
border-radius: 5px; border-radius: 5px;
& a { & a {
@ -24,12 +26,9 @@
} }
main .back { main .back {
padding:1em 0 0;
& a { & a {
text-decoration: none; text-decoration: none;
} }
& a::before { & a::before {
content: '\25C0'; content: '\25C0';
} }
@ -40,18 +39,15 @@
} }
.card { .card {
border-bottom: 1px solid rgba(34, 34, 34, 0.15);
margin-left: -40px; margin-left: -40px;
background-color: #fff; background-color: #fff;
display: grid; display: grid;
grid-template-columns: 55px auto; grid-template-columns: 55px auto;
gap: 5px; gap: 5px;
padding: 1em 0;
} }
.card_content { .card_content {
padding: 1em 0;
& .invisible { & .invisible {
display: none; display: none;
} }
@ -69,23 +65,31 @@
& .body { & .body {
& .media, & .link_card { & .media, & .link_card {
margin-bottom: 5px; border: 1px solid rgba(34, 34, 34, 0.15);
border-radius: 5px;
box-shadow: 5px 25px 10px -25px rgba(34, 34, 34, 0.15);
max-width: 100%;
margin-bottom: 1em;
object-fit: cover;
} }
& .media:hover, & .link_card:hover {
color: blue;
text-decoration-color: blue;
border-color: blue;
}
& p { & p {
margin-bottom: 1em; margin-bottom: 0.5em;
}
& img:not(.emoji), & video, & .link_card {
border-radius: 5px;
max-width: 100%;
object-fit: cover;
border: 1px solid rgba(34, 34, 34, 0.15);
} }
} }
& .author a { & .author a {
display: block;
margin-bottom: 0.5em;
text-decoration: none; text-decoration: none;
color: #232323;
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
@ -113,17 +117,10 @@
margin-top: 1em; margin-top: 1em;
} }
& .link_card:hover {
color: blue;
text-decoration-color: blue;
border-color: blue;
}
& .link_card { & .link_card {
color: #555; color: #555;
text-decoration: underline; text-decoration: underline;
text-decoration-color; #888; text-decoration-color: #888;
box-shadow: 5px 25px 10px -25px rgba(34, 34, 34, 0.15);
& strong, & small { & strong, & small {
text-decoration-thickness: 1px; text-decoration-thickness: 1px;
@ -135,13 +132,10 @@
} }
.card_avatar img { .card_avatar img {
border: 1px solid rgba(34, 34, 34, 0.35);
border-radius: 50%; border-radius: 50%;
display: inline; display: inline;
margin-top: 1em;
width: 50px; width: 50px;
} }
</style> </style>
</head> </head>
<body> <body>
@ -160,42 +154,56 @@
<ul> <ul>
{% for thread in threads %} {% for thread in threads %}
<li class="card"> <li class="card">
<div class="card_avatar"> <div class="card_avatar">
{% if thread.account.avatar is defined %} {% if thread.account.avatar is defined %}
<img class="avatar" src="{{thread.account.avatar}}" /> <a href="{{ thread.account.url }}">
<img class="avatar" src="{{ thread.account.avatar }}"
alt="avatar of {{ thread.account.display_name }}"
title="avatar of {{ thread.account.display_name }}" />
</a>
{% endif %} {% endif %}
</div> </div>
<div class="card_content"> <div class="card_content">
<h3 class="author"> <h3 class="author">
<a rel="author" href="{{thread.account.url}}">{{thread.account.display_name | safe}}</a> <a rel="author" href="{{thread.account.url}}"
>{{thread.account.display_name | safe}}</a
>
</h3> </h3>
<div class="body"> <div class="body">
{{thread.content | safe}} {{thread.content | safe}} {% if thread.descendants is defined %}
{% for media in thread.media_attachments %} {% if media.type ==
{% if thread.descendants is defined %} 'image'%}
{% for media in thread.media_attachments %} <a href="{{ media.url }}">
{% if media.type == 'image'%} <img
<img class="media" src="{{media.preview_url}}" /> class="media"
src="{{media.preview_url}}"
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
/>
</a>
{% elif media.type == 'gifv' %} {% elif media.type == 'gifv' %}
<video class="media" controls autoplay="autoplay" muted loop> <video
<source src="{{media.url}}" type="video/mp4"> class="media"
controls
autoplay="autoplay"
muted
loop
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
>
<source src="{{media.url}}" type="video/mp4" />
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
{% endif %} {% endif %} {% endfor %} {% endif %}
{% endfor %}
{% endif %}
</div> </div>
{% if thread.descendants is defined %} {% if thread.descendants is defined %}
<div class="meta"> <div class="meta">
<a href="{{thread.url}}" target="_blank">{{ thread.created_at }}</a> <a href="{{thread.url}}" target="_blank"
>{{ thread.created_at }}</a
>
</div> </div>
<ul> <ul>
@ -203,30 +211,50 @@
<li class="card descendant"> <li class="card descendant">
<div class="card_avatar"> <div class="card_avatar">
{% if descendant.account.avatar is defined %} {% if descendant.account.avatar is defined %}
<img class="avatar" src="{{thread.account.avatar}}" /> <a href="{{ descendant.account.url }}">
<img class="avatar" src="{{ descendant.account.avatar }}"
alt="avatar of {{ descendant.account.display_name }}"
title="avatar of {{ descendant.account.display_name }}" />
</a>
{% endif %} {% endif %}
</div> </div>
<div class="card_content"> <div class="card_content">
<h3 class="author">
<a rel="author" href="{{descendant.account.url}}"
>{{descendant.account.display_name | safe}}</a
>
</h3>
<div class="body"> <div class="body">
{{ descendant.content | safe }} {{ descendant.content | safe }} {% for media in
{% for media in descendant.media_attachments%} descendant.media_attachments%} {% if media.type == 'image'%}
{% if media.type == 'image'%} <a href="{{ media.url }}">
<img class="media" src="{{media.preview_url}}" /> <img
class="media"
src="{{media.preview_url}}"
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
/>
</a>
{% elif media.type == 'gifv' %} {% elif media.type == 'gifv' %}
<video class="media" controls autoplay="autoplay" muted loop> <video
<source src="{{media.url}}" type="video/mp4"> class="media"
controls
autoplay="autoplay"
muted
loop
alt="{{ media.description or 'media attachment' }}"
title="{{ media.description or 'media attachment' }}"
>
<source src="{{media.url}}" type="video/mp4" />
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
{% endif %} {% endif %} {% endfor %} {% if descendant.card %}
{% endfor %}
{% if descendant.card %}
<a href="{{ descendant.card.url }}"> <a href="{{ descendant.card.url }}">
<div class="link_card"> <div class="link_card">
<small> <small>
{{ descendant.card.provider_name or descendant.card.provider_url }} {{ descendant.card.provider_name or
descendant.card.provider_url }}
</small> </small>
<strong>{{ descendant.card.title }}</strong> <strong>{{ descendant.card.title }}</strong>
<small>{{descendant.card.description}}</small> <small>{{descendant.card.description}}</small>
@ -236,17 +264,23 @@
</div> </div>
<div class="meta"> <div class="meta">
<a href="{{descendant.url}}" target="_blank">{{ descendant.created_at }}</a> <a href="{{descendant.url}}" target="_blank"
>{{ descendant.created_at }}</a
>
</div> </div>
</div> </div>
<li> </li>
{% endfor %}
<li>{% endfor %}</li>
</ul> </ul>
{% else %} {% else %}
<a class="action" href="{{ url_for('threads.thread', id=thread.id) }}">Read full thread</a> <a
class="action"
href="{{ url_for('threads.thread', id=thread.id) }}"
>Read full thread</a
>
{% endif %} {% endif %}
</div> </div>
</li> </li>
{% endfor %} {% endfor %}