[BASE][NOTE][CSS] Notes are now clearly delimited to visually impaired users. Screen readers will notify when a note begins as well as each reply. Focused elements now provide the same feedback everywhere.

This commit is contained in:
Eliseu Amaro 2021-09-08 20:09:38 +01:00 committed by Hugo Sales
parent 60af533fa4
commit 9e051273f7
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
5 changed files with 92 additions and 64 deletions

View File

@ -3,6 +3,12 @@ html * {
scroll-margin-top: 4rem; scroll-margin-top: 4rem;
} }
*:focus:not(:active) {
border: 4px solid var(--bg3);
border-radius: var(--unit-size);
transition: border ease-in-out;
}
:root { :root {
/* FONTS */ /* FONTS */
--main-font: 'Inter var', sans-serif; --main-font: 'Inter var', sans-serif;
@ -81,7 +87,6 @@ a:visited {
color: var(--white); color: var(--white);
} }
a:focus,
a:hover { a:hover {
text-decoration: underline; text-decoration: underline;
color: var(--white); color: var(--white);
@ -106,7 +111,7 @@ summary:hover {
padding-left: var(--unit-size); padding-left: var(--unit-size);
padding-right: var(--unit-size); padding-right: var(--unit-size);
background: var(--bg3); background: var(--white);
border-radius: var(--unit-size); border-radius: var(--unit-size);
transition: var(--cubic-transition); transition: var(--cubic-transition);
@ -246,9 +251,6 @@ summary:hover .icon-details-open {
.h-entry a { .h-entry a {
text-decoration: underline; text-decoration: underline;
} }
.h-entry a:focus {
border: solid 2px var(--bg3);
}
.h-entry .embed header { .h-entry .embed header {
padding: var(--unit-size); padding: var(--unit-size);
@ -289,10 +291,6 @@ summary:hover .icon-details-open {
align-items: center; align-items: center;
align-self: center; align-self: center;
} }
.note-author:focus-within {
border: 2px solid var(--bg3);
transition: border ease-in-out;
}
.note-author .avatar { .note-author .avatar {
width: auto; width: auto;
@ -358,10 +356,6 @@ summary:hover .icon-details-open {
padding: var(--small-size); padding: var(--small-size);
} }
.note-content:focus-within {
border: 2px solid var(--bg3);
transition: border ease-in-out;
}
.note-content p { .note-content p {
padding-left: var(--small-size); padding-left: var(--small-size);
@ -597,7 +591,7 @@ input[type=file] {
margin-left: var(--medium-size); margin-left: var(--medium-size);
} }
#accessibility-menu:focus-within { #accessibility-menu:focus-within:not(:active) {
top: var(--unit-size); top: var(--unit-size);
left: var(--unit-size); left: var(--unit-size);
} }

View File

@ -86,9 +86,6 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.sec-nav {
padding-left: var(--unit-size);
}
.footer { .footer {
margin-top: auto; margin-top: auto;

View File

@ -33,17 +33,16 @@
<body class="bg"> <body class="bg">
<aside id="accessibility-menu" aria-live="polite"> <aside id="accessibility-menu">
<a accesskey="z" href="#accessibility-menu" class="anchor-hidden"></a>
<h2 id="accessibility-menu-title" tabindex="0">{{ 'Accessibility menu.' | trans }}</h2> <h2 id="accessibility-menu-title" tabindex="0">{{ 'Accessibility menu.' | trans }}</h2>
<h3>{{ 'Here you can find fast shortcuts to various page regions!' | trans }}</h3> <h3 tabindex="0">{{ 'Here you can find fast shortcuts to various page regions!' | trans }}</h3>
<br> <br>
<p>Provided the following keyboard shortcut, the link is targeted, making navigation faster.</p> <p tabindex="0">{{ 'Provided the following keyboard shortcut, the link is targeted.' | trans }}</p>
<p tabindex="0">{{ 'Be mindful that another ' | trans }}<kbd>Tab</kbd>{{ ' is needed in order to focus.' | trans }}</p>
<p> <p tabindex="0">
{% if is_firefox() == true %} {% if is_firefox() == true %}
<em><kbd>Alt</kbd> + <kbd>Shift</kbd> + "access key"</em> <em><kbd>Alt</kbd> + <kbd>Shift</kbd> + "access key"</em>
{% else %} {% else %}
@ -51,8 +50,11 @@
{% endif %} {% endif %}
</p> </p>
<p> <a accesskey="z" href="#anchor-accessibility-menu" class="anchor-hidden"></a>
<strong tabindex="0">{{'The keyboard key ' | trans }}<kbd>Z</kbd>{{' accesses this menu.' | trans }}</strong> <a id="anchor-accessibility-menu" class="anchor-hidden"></a>
<p tabindex="0">
<strong>{{'The keyboard key ' | trans }}<kbd>Z</kbd>{{' accesses this menu.' | trans }}</strong>
<strong>{{ 'The other access keys are:' | trans }}</strong> <strong>{{ 'The other access keys are:' | trans }}</strong>
</p> </p>
@ -70,7 +72,7 @@
<header id='header' role="banner"> <header id='header' role="banner">
{{ block("leftpanel", "stdgrid.html.twig") }} {{ block("leftpanel", "stdgrid.html.twig") }}
<a role="navigation" rel="help" id="anchor-main-page" class="anchor-hidden" title="{{ 'Press tab to access selected region!' | trans }}"></a> <a role="navigation" id="anchor-main-page" class="anchor-hidden" title="{{ 'Press tab to access selected region!' | trans }}"></a>
<a class="accessibility-target" id='instance' href="{{ path('main_public') }}" tabindex="0" title="{{ 'This instance\'s name. Access public timeline.' | trans }}"> <a class="accessibility-target" id='instance' href="{{ path('main_public') }}" tabindex="0" title="{{ 'This instance\'s name. Access public timeline.' | trans }}">
<h1>{{ icon('logo', 'icon icon-logo') | raw }}{{ config('site', 'name') }} </h1> <h1>{{ icon('logo', 'icon icon-logo') | raw }}{{ config('site', 'name') }} </h1>
</a> </a>

View File

@ -1,12 +1,13 @@
<article class="h-entry hentry note"> <article class="h-entry hentry note">
<header class="note-info">
{% set nickname = note.getActorNickname() %} {% set nickname = note.getActorNickname() %}
<header tabindex="0" title="{{ 'Begin a note by the user: ' | trans }} {{ nickname }}." class="note-info">
{# TODO: this should link to the note's user profile? #} {# TODO: this should link to the note's user profile? #}
<h2 tabindex="0" title='{{ 'This note author\'s nickname.' | trans }}' class="note-author u-url" href="#" aria-relevant="all"> <strong tabindex="0" class="note-author u-url">
{# Microformat's h-card properties indicates a face icon is a "u-logo" #} {# Microformat's h-card properties indicates a face icon is a "u-logo" #}
<img class="u-logo avatar" src="{{ note.getAvatarUrl() }}" alt="{{ nickname }}'s avatar" aria-hidden="true">{{ nickname }} <img class="u-logo avatar" src="{{ note.getAvatarUrl() }}" alt="{{ nickname }}'s avatar">
</h2> {{ nickname }}
</strong>
{% set reply_to = note.getReplyToNickname() %} {% set reply_to = note.getReplyToNickname() %}
{% if reply_to is not null and not skip_reply_to is defined %} {% if reply_to is not null and not skip_reply_to is defined %}
@ -51,6 +52,7 @@
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
{% if note.getLinks() is not empty %}
<div tabindex="0" class="note-links" title="{{ 'Shared links in this note.' | trans }}"> <div tabindex="0" class="note-links" title="{{ 'Shared links in this note.' | trans }}">
{% for link in note.getLinks() %} {% for link in note.getLinks() %}
{% for block in handle_event('ViewLink', {'link': link, 'note': note}) %} {% for block in handle_event('ViewLink', {'link': link, 'note': note}) %}
@ -58,16 +60,17 @@
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
</section> </section>
{% if replies is defined and replies is not empty %} {% if replies is defined and replies is not empty %}
<div class="u-in-reply-to replies"> <div class="u-in-reply-to replies" tabindex="0" title="{{ 'Begin replies to ' | trans }} {{ nickname }}'s note!">
{% for conversation in replies %} {% for conversation in replies %}
{% include '/note/view.html.twig' with {'note': conversation['note'], 'skip_reply_to': true, 'have_user': have_user, 'replies': conversation['replies']} only %} {% include '/note/view.html.twig' with {'note': conversation['note'], 'skip_reply_to': true, 'have_user': have_user, 'replies': conversation['replies']} only %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
{% if reply_to is not empty %} {% if reply_to is not empty %}
<hr> <hr tabindex="0" title="{{ 'End of this reply.' | trans }}">
{% endif %} {% endif %}
</article> </article>

View File

@ -6,8 +6,8 @@
<aside class="panel-content accessibility-target"> <aside class="panel-content accessibility-target">
{% if app.user %} {% if app.user %}
<section tabindex="0" class='profile' title="{{ 'Your profile information.' | trans }}"> <section tabindex="0" class='profile' title="{{ 'Your profile information.' | trans }}">
<a id="user" href="{{ path('settings') }}" title="{{ 'Access main settngs.' | trans }}"> <a id="user" href="{{ path('settings') }}">
<img src='{{ user_avatar }}' alt="{{ 'Your account\'s avatar.' | trans }}" class="icon icon-avatar"> <img src='{{ user_avatar }}' class="icon icon-avatar" alt="{{ 'Your account\'s avatar.' | trans }}">
<div id="user-info"> <div id="user-info">
<strong id="user-nickname" title="{{ 'Your account\' nickname.' | trans }}">{{ user_nickname }}</strong> <strong id="user-nickname" title="{{ 'Your account\' nickname.' | trans }}">{{ user_nickname }}</strong>
@ -21,61 +21,83 @@
{% endif %} {% endif %}
</nav> </nav>
<section id="user-stats" title="{{ 'Your account statistics.' | trans }}"> <section id="user-stats">
{% if user_followers %}<h2>{{ 'Followers' | trans }} {{ user_followers }}</h2> {% endif %} {% if user_followers %}<h2>{{ 'Followers' | trans }} {{ user_followers }}</h2> {% endif %}
{% if user_followed %}<h2>{{ 'Followed' | trans }} {{ user_followed }}</h2> {% endif %} {% if user_followed %}<h2>{{ 'Followed' | trans }} {{ user_followed }}</h2> {% endif %}
</section> </section>
</div> </div>
</a> </a>
</section>
{# {% for extra in profile_extras %} {# {% for extra in profile_extras %}
{% include '/'~ extra.name ~ '/view.html.twig' with {'vars': extra.vars} only %} {% include '/'~ extra.name ~ '/view.html.twig' with {'vars': extra.vars} only %}
{% endfor %} #} {% endfor %} #}
</section>
<nav class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}" aria-relevant="all"> <nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}">
<a href='{{ path('settings') }}' class='{{ active("replies") }}' title="{{ 'Your messages.' | trans }}">Messages</a> <a title='{{ 'Your messages.' | trans }}' href='{{ path('settings') }}' class='{{ active("replies") }}'>
<a href="{{ path("replies", {'nickname' : user_nickname}) }}" Messages
class='{{ active("replies") }}' title="{{ 'Replies to your notes.' | trans }}">Replies</a> </a>
<a title='{{ 'Replies to your notes.' | trans }}' href="{{ path('replies', {'nickname' : user_nickname}) }}" class='{{ active("replies") }}'>
Replies
</a>
{% for link in handle_event('InsertLeftPanelLink', user_nickname) %} {% for link in handle_event('InsertLeftPanelLink', user_nickname) %}
{{ link | raw }} {{ link | raw }}
{% endfor %} {% endfor %}
<a href="{{ path('settings') }}"
class='{{ active('settings') }}' title="{{ 'Access your account settings.' | trans }}">Settings</a> <a title='{{ 'Access your account settings.' | trans }}' href="{{ path('settings') }}" class='{{ active('settings') }}'>
<a href='{{ path('logout') }}' title="{{ 'Logout from your account.' | trans }}">Logout</a> Settings
</a>
<a title='{{ 'Logout from your account.' | trans }}' href='{{ path('logout') }}'>
Logout
</a>
</nav> </nav>
{% else %} {% else %}
<nav class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}" aria-relevant="all"> <nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}">
<a href="{{ path('login') }}" class='hover-effect {{ active('login') }}' title="{{ 'Login with your existing account.' | trans }}">Login</a>
<a href="{{ path('register') }}" title="{{ 'Register a new account!' | trans }}">Register</a> <a title='{{ 'Login with your existing account.' | trans }}' href="{{ path('login') }}" class='hover-effect {{ active('login') }}'>
Login
</a>
<a title='{{ 'Register a new account!' | trans }}' href="{{ path('register') }}">
Register
</a>
</nav> </nav>
{% endif %} {% endif %}
<div class="timeline-nav"> <div class="timeline-nav">
<nav class='sec-nav' tabindex="0" title="{{ 'Navigate through each timeline.' | trans }}">
<strong id="timeline-nav-header">Timeline</strong> <strong id="timeline-nav-header">Timeline</strong>
<nav class='sec-nav' tabindex="0" title="{{ 'Navigate through each timeline.' | trans }}" aria-relevant="all">
<ul> <ul>
<li> <li>
<a href="{{ path('main_public') }}" <a href="{{ path('main_public') }}" class='{{ active('main_public') }}'>
class='{{ active('main_public') }}'>Public</a> Public
</a>
</li> </li>
<li> <li>
{% if user_nickname is defined %} {% if user_nickname is defined %}
<a href="{{ path("home_all", {'nickname' : user_nickname}) }}" <a href="{{ path("home_all", {'nickname' : user_nickname}) }}" class='{{ active("home_all") }}'>
class='{{ active("home_all") }}'>Home</a> Home
</a>
{% endif %} {% endif %}
</li> </li>
<li> <li>
<a href="{{ path('main_all') }}" class='hover-effect {{ active('main_all') }}'>Network</a> <a href="{{ path('main_all') }}" class='hover-effect {{ active('main_all') }}'>
Network
</a>
</li> </li>
{% if main_nav_tabs is defined %} {% if main_nav_tabs is defined %}
{% for tab in main_nav_tabs %} {% for tab in main_nav_tabs %}
<li> <li>
<a href="{{ path(tab['route']) }}" <a href="{{ path(tab['route']) }}" class='{{ active(tab['route']) }}'>
class='{{ active(tab['route']) }}'>{{ tab['title'] }}</a> {{ tab['title'] }}
</a>
</li> </li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -85,11 +107,21 @@
<footer class="footer"> <footer class="footer">
<nav> <nav>
<a href="{{ path('doc_faq') }}" class='hover-effect {{ active('doc_faq') }}'>FAQ</a> <a href="{{ path('doc_faq') }}" class='hover-effect {{ active('doc_faq') }}'>
<a href="{{ path('doc_tos') }}" class='hover-effect {{ active('doc_tos') }}'>TOS</a> FAQ
<a href="{{ path('doc_privacy') }}" class='hover-effect {{ active('doc_privacy') }}'>Privacy</a> </a>
<a href="{{ path('doc_source') }}" class='hover-effect {{ active('doc_source') }}'>Source</a> <a href="{{ path('doc_tos') }}" class='hover-effect {{ active('doc_tos') }}'>
<a href="{{ path('doc_version') }}" class='hover-effect {{ active('doc_version') }}'>Version</a> TOS
</a>
<a href="{{ path('doc_privacy') }}" class='hover-effect {{ active('doc_privacy') }}'>
Privacy
</a>
<a href="{{ path('doc_source') }}" class='hover-effect {{ active('doc_source') }}'>
Source
</a>
<a href="{{ path('doc_version') }}" class='hover-effect {{ active('doc_version') }}'>
Version
</a>
</nav> </nav>
</footer> </footer>
</aside> </aside>