question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

aria tag gets removed entirely on "false"

See original GitHub issue

When you use a screenreader to visit an accordion (dropdown) you need the aria-expanded to be “false” on init. Vue automatically removes the aria-expanded tag entirely when false. Is there a way to keep the aria-expanded tag with a “false” value.

<button type="button" class="bl-panel__header bl-panel__header--has-action" @click.prevent="isOpened1 = !isOpened1" :aria-expanded="isOpened1" aria-controls="dropdown-1">
        <span aria-hidden="true" class="bl-panel__header__toggle vi vi-u-badge vi-u-badge--small vi-arrow vi-u-90deg" :class="{'bl-panel__header__toggle--reverse': !isOpened1}"></span>
        <div class="bl-panel__header__content">
          <h1 class="bl-panel__header__content__title">
            Call to action (button)
          </h1>
          <h2 class="bl-panel__header__content__subtitle">
            Schoolabonnementen
          </h2>
        </div>
      </button>

:aria-expanded=“isOpened1” is removed on false.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ktsncommented, Jul 19, 2017

You can stringify your variable.

:aria-expanded="String(isOpened1)"
0reactions
warrebuyssecommented, Jul 19, 2017

@ktsn Genius! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

False value cause aria boolean attributes to be removed from ...
Aria attributes are not present in the DOM when their value is false. Unlike for html 5 boolean values, removing aria attributes from...
Read more >
aria-disabled - Accessibility - MDN Web Docs
The aria-disabled state indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
Read more >
Using ARIA - W3C
This document is a practical guide for developers on how to add accessibility information to HTML elements using the Accessible Rich Internet ...
Read more >
What you need to know about ARIA and how to fix common ...
It's common for the wrong aria-label to get assigned because the code was copied and pasted and then changed. The issue isn't caught...
Read more >
Know your ARIA: 'Hidden' vs 'None' | scottohara.me
Conversely, If the element has aria-hidden=false it is meant to be exposed to assistive technologies as if the attribute were not set at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found