Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving accessibility with ARIA attributes in templates #1865

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
66e1831
Improve accessibility with ARIA attrs in base.html
ACK1D Dec 23, 2023
ea42f15
Improve accessibility with ARIA atts in redirect
ACK1D Dec 23, 2023
f28f6b0
Improve a11y with ARIA atts in panel_button
ACK1D Dec 23, 2023
aa9d9c1
Improve a11y with ARIA atts in panel_content
ACK1D Dec 23, 2023
e906e52
Improve a11y with ARIA atts in cache.html
ACK1D Dec 23, 2023
30b5518
Improve a11y with ARIA atts in headers.html
ACK1D Dec 23, 2023
d33aac8
Improve a11y with ARIA atts in history_tr.html
ACK1D Dec 23, 2023
bf81fa6
Improve a11y with ARIA atts in history.html
ACK1D Dec 23, 2023
826c862
Improve a11y with ARIA atts in profiling.html
ACK1D Dec 23, 2023
474468c
Improve a11y with ARIA atts in request_variables
ACK1D Dec 23, 2023
56d836b
Improve a11y with ARIA atts in request.html
ACK1D Dec 23, 2023
63d747f
Improve a11y with ARIA atts in settings.html
ACK1D Dec 23, 2023
8177c79
Improve a11y with ARIA atts in signals.html
ACK1D Dec 23, 2023
3bf5360
Improve a11y with ARIA atts in sql_explain.html
ACK1D Dec 23, 2023
59e5870
Improve a11y with ARIA atts in sql_profile.html
ACK1D Dec 23, 2023
03144db
Improve a11y with ARIA atts in sql_select.html
ACK1D Dec 23, 2023
7494e9a
Improve a11y with ARIA atts in sql.html
ACK1D Dec 23, 2023
f972f09
Improve a11y with ARIA atts in staticfiles.html
ACK1D Dec 23, 2023
0fc8a08
Improve a11y with ARIA atts in template_source
ACK1D Dec 23, 2023
016af88
Improve a11y with ARIA atts in templates.html
ACK1D Dec 23, 2023
135ba6e
Improve a11y with ARIA atts in timer.html
ACK1D Dec 23, 2023
767d6b0
Improve a11y with ARIA atts in versions.html
ACK1D Dec 23, 2023
640dbb3
fix tests
ACK1D Dec 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 36 additions & 23 deletions debug_toolbar/templates/debug_toolbar/base.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,51 @@
{% load i18n static %}

{% block css %}
<link rel="stylesheet" href="{% static 'debug_toolbar/css/print.css' %}" media="print">
<link rel="stylesheet" href="{% static 'debug_toolbar/css/toolbar.css' %}">
<link rel="stylesheet" href="{% static 'debug_toolbar/css/print.css' %}" media="print">
<link rel="stylesheet" href="{% static 'debug_toolbar/css/toolbar.css' %}">
{% endblock %}

{% block js %}
<script type="module" src="{% static 'debug_toolbar/js/toolbar.js' %}" async></script>
<script type="module" src="{% static 'debug_toolbar/js/toolbar.js' %}" async></script>
{% endblock %}

<div id="djDebug" class="djdt-hidden" dir="ltr"
{% if not toolbar.should_render_panels %}
data-store-id="{{ toolbar.store_id }}"
data-render-panel-url="{% url 'djdt:render_panel' %}"
data-store-id="{{ toolbar.store_id }}"
data-render-panel-url="{% url 'djdt:render_panel' %}"
{% endif %}
{% url 'djdt:history_sidebar' as history_url %}
{% if history_url %}
data-sidebar-url="{{ history_url }}"
data-sidebar-url="{{ history_url }}"
{% endif %}
data-default-show="{% if toolbar.config.SHOW_COLLAPSED %}false{% else %}true{% endif %}"
{{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }}>
<div class="djdt-hidden" id="djDebugToolbar">
<ul id="djDebugPanelList">
<li><a id="djHideToolBarButton" href="#" title="{% trans 'Hide toolbar' %}">{% trans "Hide" %} »</a></li>
{% for panel in toolbar.panels %}
{% include "debug_toolbar/includes/panel_button.html" %}
{% endfor %}
</ul>
</div>
<div class="djdt-hidden" id="djDebugToolbarHandle">
<div title="{% trans 'Show toolbar' %}" id="djShowToolBarButton">
<span id="djShowToolBarD">D</span><span id="djShowToolBarJ">J</span>DT
{{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }}
aria-live="polite"
role="status"
aria-busy="{% if toolbar.config.SHOW_COLLAPSED %}true{% else %}false{% endif %}">

<div class="djdt-hidden" id="djDebugToolbar" aria-hidden="true">
<ul id="djDebugPanelList">
<li>
<a id="djHideToolBarButton" href="#" title="{% trans 'Hide toolbar' %}">
{% trans "Hide" %} »
</a>
</li>
{% for panel in toolbar.panels %}
{% include "debug_toolbar/includes/panel_button.html" %}
{% endfor %}
</ul>
</div>
</div>

{% for panel in toolbar.panels %}
{% include "debug_toolbar/includes/panel_content.html" %}
{% endfor %}
<div id="djDebugWindow" class="djdt-panelContent djdt-hidden"></div>
<div class="djdt-hidden" id="djDebugToolbarHandle">
<div title="{% trans 'Show toolbar' %}" id="djShowToolBarButton" role="button" tabindex="0">
<span id="djShowToolBarD">D</span><span id="djShowToolBarJ">J</span>DT
</div>
</div>

{% for panel in toolbar.panels %}
{% include "debug_toolbar/includes/panel_content.html" %}
{% endfor %}

<div id="djDebugWindow" class="djdt-panelContent djdt-hidden" aria-hidden="true"></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% load i18n %}

<li id="djdt-{{ panel.panel_id }}" class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdt{{ panel.panel_id }}" {% if panel.enabled %}checked title="{% trans "Disable for next and successive requests" %}"{% else %}title="{% trans "Enable for next and successive requests" %}"{% endif %}>
<li id="djdt-{{ panel.panel_id }}" class="djDebugPanelButton" role="checkbox">
<input type="checkbox" data-cookie="djdt{{ panel.panel_id }}" {% if panel.enabled %}checked title="{% trans "Disable for next and successive requests" %}"{% else %}title="{% trans "Enable for next and successive requests" %}"{% endif %} aria-label="{% if panel.enabled %}{% trans "Disable for next and successive requests" %}{% else %}{% trans "Enable for next and successive requests" %}{% endif %}">
{% if panel.has_content and panel.enabled %}
<a href="#" title="{{ panel.title }}" class="{{ panel.panel_id }}">
<a href="#" title="{{ panel.title }}" class="{{ panel.panel_id }}" role="link">
{% else %}
<div class="djdt-contentless{% if not panel.enabled %} djdt-disabled{% endif %}">
<div class="djdt-contentless{% if not panel.enabled %} djdt-disabled{% endif %}" role="presentation">
{% endif %}
{{ panel.nav_title }}
{% if panel.enabled %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{% load static %}
{% load i18n static %}

{% if panel.has_content and panel.enabled %}
<div id="{{ panel.panel_id }}" class="djdt-panelContent djdt-hidden">
<div id="{{ panel.panel_id }}" class="djdt-panelContent djdt-hidden" role="region" aria-labelledby="djdt-{{ panel.panel_id }}-title">
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">×</button>
<button type="button" class="djDebugClose" aria-label="{% trans "Close" %}">×</button>
<h3>{{ panel.title }}</h3>
</div>
<div class="djDebugPanelContent">
{% if toolbar.should_render_panels %}
{% for script in panel.scripts %}<script type="module" src="{{ script }}" async></script>{% endfor %}
<div class="djdt-scroll">{{ panel.content }}</div>
<div class="djdt-scroll" aria-live="polite" aria-atomic="true">{{ panel.content }}</div>
{% else %}
<div class="djdt-loader"></div>
<div class="djdt-scroll"></div>
<div class="djdt-loader" role="alert" aria-busy="true"></div>
<div class="djdt-scroll" aria-live="polite" aria-atomic="true"></div>
{% endif %}
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions debug_toolbar/templates/debug_toolbar/panels/cache.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load i18n %}
<h4>{% trans "Summary" %}</h4>
<table>
<h4 id="summary-heading">{% trans "Summary" %}</h4>
<table aria-labelledby="summary-heading">
<thead>
<tr>
<th>{% trans "Total calls" %}</th>
Expand All @@ -18,8 +18,8 @@ <h4>{% trans "Summary" %}</h4>
</tr>
</tbody>
</table>
<h4>{% trans "Commands" %}</h4>
<table>
<h4 id="commands-heading">{% trans "Commands" %}</h4>
<table aria-labelledby="commands-heading">
<thead>
<tr>
{% for name in counts.keys %}
Expand All @@ -36,8 +36,8 @@ <h4>{% trans "Commands" %}</h4>
</tbody>
</table>
{% if calls %}
<h4>{% trans "Calls" %}</h4>
<table>
<h4 id="calls-heading">{% trans "Calls" %}</h4>
<table aria-labelledby="calls-heading">
<thead>
<tr>
<th colspan="2">{% trans "Time (ms)" %}</th>
Expand All @@ -59,7 +59,7 @@ <h4>{% trans "Calls" %}</h4>
<td>{{ call.kwargs|escape }}</td>
<td>{{ call.backend }}</td>
</tr>
<tr class="djUnselected djToggleDetails_{{ forloop.counter }}" id="cacheDetails_{{ forloop.counter }}">
<tr class="djUnselected djToggleDetails_{{ forloop.counter }}" id="cacheDetails_{{ forloop.counter }}" aria-hidden="true">
<td colspan="1"></td>
<td colspan="5"><pre class="djdt-stack">{{ call.trace }}</pre></td>
</tr>
Expand Down
12 changes: 6 additions & 6 deletions debug_toolbar/templates/debug_toolbar/panels/headers.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% load i18n %}

<h4>{% trans "Request headers" %}</h4>
<h4 id="request-headers">{% trans "Request headers" %}</h4>

<table>
<table aria-labelledby="request-headers">
<thead>
<tr>
<th>{% trans "Key" %}</th>
Expand All @@ -19,9 +19,9 @@ <h4>{% trans "Request headers" %}</h4>
</tbody>
</table>

<h4>{% trans "Response headers" %}</h4>
<h4 id="response-headers">{% trans "Response headers" %}</h4>

<table>
<table aria-labelledby="response-headers">
<thead>
<tr>
<th>{% trans "Key" %}</th>
Expand All @@ -38,11 +38,11 @@ <h4>{% trans "Response headers" %}</h4>
</tbody>
</table>

<h4>{% trans "WSGI environ" %}</h4>
<h4 id="wsgi-environ">{% trans "WSGI environ" %}</h4>

<p>{% trans "Since the WSGI environ inherits the environment of the server, only a significant subset is shown below." %}</p>

<table>
<table aria-labelledby="wsgi-environ">
<thead>
<tr>
<th>{% trans "Key" %}</th>
Expand Down
22 changes: 11 additions & 11 deletions debug_toolbar/templates/debug_toolbar/panels/history.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{% load i18n %}{% load static %}
{% load i18n static %}
<form method="get" action="{% url 'djdt:history_refresh' %}">
{{ refresh_form }}
<button class="refreshHistory">Refresh</button>
<button class="refreshHistory">{% trans "Refresh" %}</button>
</form>
<table class="djdt-max-height-100">
<table class="djdt-max-height-100" role="grid" aria-labelledby="history-table-heading">
<thead>
<tr>
<th>{% trans "Time" %}</th>
<th>{% trans "Method" %}</th>
<th>{% trans "Path" %}</th>
<th>{% trans "Request Variables" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Action" %}</th>
<tr role="row">
<th role="columnheader">{% trans "Time" %}</th>
<th role="columnheader">{% trans "Method" %}</th>
<th role="columnheader">{% trans "Path" %}</th>
<th role="columnheader">{% trans "Request Variables" %}</th>
<th role="columnheader">{% trans "Status" %}</th>
<th role="columnheader">{% trans "Action" %}</th>
</tr>
</thead>
<tbody id="djdtHistoryRequests">
<tbody id="djdtHistoryRequests" role="rowgroup">
{% for id, store_context in stores.items %}
{% include "debug_toolbar/panels/history_tr.html" %}
{% endfor %}
Expand Down
8 changes: 4 additions & 4 deletions debug_toolbar/templates/debug_toolbar/panels/history_tr.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n %}
<tr class="{% if id == current_store_id %}djdt-highlighted{% endif %}" id="historyMain_{{ id }}" data-store-id="{{ id }}">
<tr class="{% if id == current_store_id %}djdt-highlighted{% endif %}" id="historyMain_{{ id }}" data-store-id="{{ id }}" role="row">
<td>
{{ store_context.toolbar.stats.HistoryPanel.time|escape }}
</td>
Expand All @@ -10,9 +10,9 @@
<p>{{ store_context.toolbar.stats.HistoryPanel.request_url|truncatechars:100|escape }}</p>
</td>
<td>
<button type="button" class="djToggleSwitch" data-toggle-name="historyMain" data-toggle-id="{{ id }}">+</button>
<div class="djUnselected djToggleDetails_{{ id }}">
<table>
<button type="button" class="djToggleSwitch" data-toggle-name="historyMain" data-toggle-id="{{ id }}" aria-expanded="false" aria-controls="historyDetails_{{ id }}">+</button>
<div class="djUnselected djToggleDetails_{{ id }}" id="historyDetails_{{ id }}" aria-hidden="true">
<table aria-labelledby="historyMain_{{ id }}">
<colgroup>
<col class="djdt-width-20">
<col>
Expand Down
22 changes: 11 additions & 11 deletions debug_toolbar/templates/debug_toolbar/panels/profiling.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{% load i18n %}
<table>
<table role="grid" aria-labelledby="profiling-table-heading">
<thead>
<tr>
<th>{% trans "Call" %}</th>
<th>{% trans "CumTime" %}</th>
<th>{% trans "Per" %}</th>
<th>{% trans "TotTime" %}</th>
<th>{% trans "Per" %}</th>
<th>{% trans "Count" %}</th>
<tr role="row">
<th role="columnheader">{% trans "Call" %}</th>
<th role="columnheader">{% trans "CumTime" %}</th>
<th role="columnheader">{% trans "Per" %}</th>
<th role="columnheader">{% trans "TotTime" %}</th>
<th role="columnheader">{% trans "Per" %}</th>
<th role="columnheader">{% trans "Count" %}</th>
</tr>
</thead>
<tbody>
<tbody role="rowgroup">
{% for call in func_list %}
<tr class="djdt-profile-row {% if call.is_project_func %}djdt-highlighted {% endif %} {% for parent_id in call.parent_ids %} djToggleDetails_{{ parent_id }}{% endfor %}" id="profilingMain_{{ call.id }}">
<tr role="row" class="djdt-profile-row {% if call.is_project_func %}djdt-highlighted {% endif %} {% for parent_id in call.parent_ids %} djToggleDetails_{{ parent_id }}{% endfor %}" id="profilingMain_{{ call.id }}">
<td>
<div data-djdt-styles="paddingLeft:{{ call.indent }}px">
{% if call.has_subfuncs %}
<button type="button" class="djProfileToggleDetails djToggleSwitch" data-toggle-name="profilingMain" data-toggle-id="{{ call.id }}">-</button>
<button type="button" class="djProfileToggleDetails djToggleSwitch" data-toggle-name="profilingMain" data-toggle-id="{{ call.id }}" aria-expanded="false" aria-controls="profilingDetails_{{ call.id }}">-</button>
{% else %}
<span class="djNoToggleSwitch"></span>
{% endif %}
Expand Down
26 changes: 13 additions & 13 deletions debug_toolbar/templates/debug_toolbar/panels/request.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% load i18n %}

<h4>{% trans "View information" %}</h4>
<table>
<h4 id="view-info-heading">{% trans "View information" %}</h4>
<table role="table" aria-labelledby="view-info-heading">
<thead>
<tr>
<th>{% trans "View function" %}</th>
<th>{% trans "Arguments" %}</th>
<th>{% trans "Keyword arguments" %}</th>
<th>{% trans "URL name" %}</th>
<tr role="row">
<th role="columnheader">{% trans "View function" %}</th>
<th role="columnheader">{% trans "Arguments" %}</th>
<th role="columnheader">{% trans "Keyword arguments" %}</th>
<th role="columnheader">{% trans "URL name" %}</th>
</tr>
</thead>
<tbody>
<tr>
<tbody role="rowgroup">
<tr role="row">
<td><code>{{ view_func }}</code></td>
<td><code>{{ view_args|pprint }}</code></td>
<td><code>{{ view_kwargs|pprint }}</code></td>
Expand All @@ -21,28 +21,28 @@ <h4>{% trans "View information" %}</h4>
</table>

{% if cookies.list or cookies.raw %}
<h4>{% trans "Cookies" %}</h4>
<h4 id="cookies-heading">{% trans "Cookies" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=cookies %}
{% else %}
<h4>{% trans "No cookies" %}</h4>
{% endif %}

{% if session.list or session.raw %}
<h4>{% trans "Session data" %}</h4>
<h4 id="session-heading">{% trans "Session data" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=session %}
{% else %}
<h4>{% trans "No session data" %}</h4>
{% endif %}

{% if get.list or get.raw %}
<h4>{% trans "GET data" %}</h4>
<h4 id="get-heading">{% trans "GET data" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=get %}
{% else %}
<h4>{% trans "No GET data" %}</h4>
{% endif %}

{% if post.list or post.raw %}
<h4>{% trans "POST data" %}</h4>
<h4 id="post-heading">{% trans "POST data" %}</h4>
{% include 'debug_toolbar/panels/request_variables.html' with variables=post %}
{% else %}
<h4>{% trans "No POST data" %}</h4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{% load i18n %}

{% if variables.list %}
<table>
<table role="table" aria-labelledby="request-variables-table-heading">
<colgroup>
<col class="djdt-width-20">
<col>
</colgroup>
<thead>
<tr>
<th>{% trans "Variable" %}</th>
<th>{% trans "Value" %}</th>
<tr role="row">
<th role="columnheader">{% trans "Variable" %}</th>
<th role="columnheader">{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
<tbody role="rowgroup">
{% for key, value in variables.list %}
<tr>
<tr role="row">
<td><code>{{ key|pprint }}</code></td>
<td><code>{{ value|pprint }}</code></td>
</tr>
Expand Down
15 changes: 8 additions & 7 deletions debug_toolbar/templates/debug_toolbar/panels/settings.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{% load i18n %}
<table>
<thead>
<tr>
<th>{% trans "Setting" %}</th>
<th>{% trans "Value" %}</th>

<table role="table" aria-labelledby="settings-heading">
<thead role="rowgroup">
<tr role="row">
<th role="columnheader">{% trans "Setting" %}</th>
<th role="columnheader">{% trans "Value" %}</th>
</tr>
</thead>
<tbody>
<tbody role="rowgroup">
{% for name, value in settings.items %}
<tr>
<tr role="row">
<td>{{ name }}</td>
<td><code>{{ value|pprint }}</code></td>
</tr>
Expand Down
Loading