Skip to content

Commit a80dbc5

Browse files
committed
feature #37889 Toolbar toggler accessibility (Chi-teck)
This PR was squashed before being merged into the 5.2-dev branch. Discussion ---------- Toolbar toggler accessibility | Q | A | ------------- | --- | Branch | master | Bug fix | yes | New feature | no | Deprecations |no | Tickets | Fix #37739 | License | MIT Commits ------- 4333dd0 Toolbar toggler accessibility
2 parents c3ce47e + 4333dd0 commit a80dbc5

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,11 @@
473473
}
474474
};
475475
}
476-
addEventListener(document.getElementById('sfToolbarHideButton-' + newToken), 'click', function (event) {
476+
var hideButton = document.getElementById('sfToolbarHideButton-' + newToken);
477+
var hideButtonSvg = hideButton.querySelector('svg');
478+
hideButtonSvg.setAttribute('aria-hidden', 'true');
479+
hideButtonSvg.setAttribute('focusable', 'false');
480+
addEventListener(hideButton, 'click', function (event) {
477481
event.preventDefault();
478482
479483
var p = this.parentNode;
@@ -482,7 +486,11 @@
482486
document.getElementById('sfMiniToolbar-' + newToken).style.display = 'block';
483487
setPreference('toolbar/displayState', 'none');
484488
});
485-
addEventListener(document.getElementById('sfToolbarMiniToggler-' + newToken), 'click', function (event) {
489+
var showButton = document.getElementById('sfToolbarMiniToggler-' + newToken);
490+
var showButtonSvg = showButton.querySelector('svg');
491+
showButtonSvg.setAttribute('aria-hidden', 'true');
492+
showButtonSvg.setAttribute('focusable', 'false');
493+
addEventListener(showButton, 'click', function (event) {
486494
event.preventDefault();
487495
488496
var elem = this.parentNode;

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
z-index: 99999;
1515
}
1616

17-
.sf-minitoolbar a {
18-
display: block;
17+
.sf-minitoolbar button {
18+
background-color: transparent;
19+
padding: 0;
20+
border: none;
1921
}
2022
.sf-minitoolbar svg,
2123
.sf-minitoolbar img {
@@ -81,10 +83,13 @@
8183
height: 36px;
8284
cursor: pointer;
8385
text-align: center;
86+
border: none;
87+
margin: 0;
88+
padding: 0;
8489
}
8590
.sf-toolbarreset .hide-button svg {
8691
max-height: 18px;
87-
margin-top: 10px;
92+
margin-top: 1px;
8893
}
8994

9095
.sf-toolbar-block {

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!-- START of Symfony Web Debug Toolbar -->
22
<div id="sfMiniToolbar-{{ token }}" class="sf-minitoolbar" data-no-turbolink>
3-
<a href="#" title="Show Symfony toolbar" tabindex="-1" id="sfToolbarMiniToggler-{{ token }}" accesskey="D">
3+
<button type="button" title="Show Symfony toolbar" id="sfToolbarMiniToggler-{{ token }}" accesskey="D" aria-expanded="false" aria-controls="sfToolbarMainContent-{{ token }}">
44
{{ include('@WebProfiler/Icon/symfony.svg') }}
5-
</a>
5+
</button>
66
</div>
77
<div id="sfToolbarClearer-{{ token }}" class="sf-toolbar-clearer"></div>
88

@@ -23,8 +23,8 @@
2323
{% endif %}
2424
{% endfor %}
2525

26-
<a class="hide-button" id="sfToolbarHideButton-{{ token }}" title="Close Toolbar" tabindex="-1" accesskey="D">
26+
<button class="hide-button" type="button" id="sfToolbarHideButton-{{ token }}" title="Close Toolbar" accesskey="D" aria-expanded="true" aria-controls="sfToolbarMainContent-{{ token }}">
2727
{{ include('@WebProfiler/Icon/close.svg') }}
28-
</a>
28+
</button>
2929
</div>
3030
<!-- END of Symfony Web Debug Toolbar -->

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy