'P-tablecheckbox (form label not present 508 wave issue)

I just want to know how can we get rid of 508 issue for wave for p-tablecheckbox which states "Form label not present". Basically, we have one p-table inside which there is p-tablecheckbox where we tried using aria-label too but it is not working. So, is there any alternate way where i can get some straightforward technique to resolve this ongoing issue with p-tablecheckbox. Any help would be appreciated. Thank you.



Solution 1:[1]

"ariaLabel" property is added for p-tablecheckbox in latest version. If you are unable to use latest version, here is a work around. Add aria label in typescript code. First define your aria label in labels list. Then,

this.elements = document.getElementsByClassName("p-checkbox");
    for (let i = 0; i < this.elements.length; i++) {
        this.elements[i].ariaLabel = this.labels[i];
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Patrick Yang