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.

[Bug Report][2.6.2] VSelect validation errors

See original GitHub issue

Environment

Vuetify Version: 2.6.2 Vue Version: 2.6.12 Browsers: Chrome 97.0.4692.71 OS: Mac OS 10.15.7

Steps to reproduce

  1. Get HTML output for v-select component
  2. Run it through W3C HTML validator at https://validator.w3.org/
  3. See errors show below

Expected Behavior

HTML markup should validate

Actual Behavior

Three errors are returned:

  • The element label must not appear as a descendant of an element with the attribute role=button.
  • Attribute aria-readonly must not be specified on elements that have attribute readonly.
  • The element input must not appear as a descendant of an element with the attribute role=button.

Reproduction Link

https://codepen.io/apfrod/pen/OJxdLEw

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
agreedSkiingcommented, Feb 11, 2022

A stupid workaround to fix the html validation is to use mounted BUT this is not good. mounted() { this.$el.querySelectorAll(".v-input__slot")?.removeAttribute("role") }

0reactions
apfrodcommented, Mar 31, 2022

I’ve ended up with this in my App.vue to swap role=button for role=combobox and remove redundant aria-readonly

mounted() {
    const removeAriaReadonly = function(input){
      const ariareadonly = input.attributes.getNamedItem("aria-readonly")
      const readonly = input.attributes.getNamedItem("readonly")
      if (ariareadonly && readonly){
        // remove redundant readonly property
        input.removeAttribute("aria-readonly")
      }
    }
    const swapRoles = function(el){
      const role = el.attributes.getNamedItem("role")
      if (role && role.value == 'button'){
        // use role 'combobox' instead of 'button'
        el.setAttribute("role", "combobox")
      }
    }
    // run on each future mutation
    const callback = new MutationObserver((mutations) => {
      mutations.forEach((mutation) => {
        const element = mutation.target
        const inputs = element.querySelectorAll("input")
        inputs.forEach(removeAriaReadonly)
        const inputslots = element.querySelectorAll(".v-select .v-input__slot")
        inputslots.forEach(swapRoles)
      })
    })
    const content = this.$root.$el.querySelector(".v-main")
    callback.observe(content, {
      subtree: true,
      attributes: true,
    })
    // run now on elements already mutated at mount time
    this.$el.querySelectorAll("input").forEach(removeAriaReadonly)
    this.$el.querySelectorAll(".v-select .v-input__slot").forEach(swapRoles)
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

vue.js - v-select on close event or remove validation error timer?
I want to be able to clear the validation error after X seconds if the user didn't select anything. As you can see...
Read more >
Troubleshooting Guide - IBM
Configuration agent failed to pass validation . . 70. Scheduled actions failed with the error message. KCF0007E Target object is locked by another...
Read more >
Separating IDM Applications into Multiple Domains - Oracle
Troubleshooting Item #9: LDAP Connection Error: [PLUGIN][OIM] - ERROR - CLONE-71000 configuration Failed. Exiting configuration due to data validation failure.
Read more >
Required - Vue Select
Required. If you need to ensure that a selection is made before a form is ... <v-select :options="books" label="title" v-model="selected"> <template ...
Read more >
v-select API - Vuetify
name type default #append‑icon string '$dropdown' #append‑outer‑icon string undefined #attach any false
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