- πΊπΈUnited States majorrobot
This is likely caused by the template your admin theme is using.
I found that I was able to resolve these issues by overriding the toolbar template. It was a bit tricky since I had to add a template suggestion to wrest control out of my admin theme's (Claro's) grip.
I put this in my .theme file:
function my_theme_theme_suggestions_toolbar_alter(array &$suggestions, array $variables) { // Add theme hook suggestions for toolbar so that we can override Claro. Otherwise, we just get Claro's template. if (!empty($variables['element']['#attributes']['id'])) { $suggestions[] = 'toolbar__' . str_replace('-', '_', $variables['element']['#attributes']['id']); } }
Then I copied Claro's
toolbar.html.twig
into my theme astoolbar--toolbar-administration.html.twig
.In the twig file, I saw
{% for key, tab in tabs %} ... <nav class="toolbar-lining clearfix" role="navigation"> ... {% endfor %}
Which was causing trouble -- there's not a unique name on this element, which could be used several times. So I added an iterator:
{% set i = 0 %} {% for key, tab in tabs %} ... <nav class="toolbar-lining clearfix" role="navigation" aria-label="admin-toolbar-nav-{{ i }}"> ... {% set i = i + 1 %} {% endfor %}
For your second issue (which I also had), I added a landmark to wrap the whole toolbar. I haven't run this past any accessibility experts yet, but this does pass Axe's test:
<section id="toolbar-wrapper"> <div{{ attributes.addClass('toolbar') }}> <nav{{ toolbar_attributes.addClass('toolbar-bar', 'clearfix') }}> ... </section>
I hope this helps someone!
- πΊπΈUnited States kentr Durango, CO
I'm seeing almost identical errors without this module, so these problems may be in core. I'm looking into it further and will file core issues if needed.
- πΊπΈUnited States majorrobot
@kentr -- agreed. Admin Toolbar uses the admin theme's toolbar template, and the root issue -- for me, at least -- was in the Claro theme.
- πΊπΈUnited States kentr Durango, CO
π± [META] improve accessibility of toolbar Active covers these.
I suggest closing this issue.