Accessibility compliance of specific table HTML

Viewed 89

I have an HTML layout engine that has a common component that can switch between ol HTML, ul HTML, and table HTML structure

<component>
    <ul>
        <li>
            <div> Enter Data here </div>
        </li>
        <li>
            <div> Enter Data here </div>
        </li>
    </ul>
</component>

OR

<component>
    <table>
        <tr>
            <div> 
                <th>
                    Enter Data here 
                </th>
                <th>
                    Enter Data here 
                </th>
            </div>
        </tr>
        <tr>
            <div> 
                <td>
                    Enter Data here 
                </td>
                <td>
                    Enter Data here 
                </td>
            </div>
        </tr>
        <tr>
            <div> 
                <td>
                    Enter Data here 
                </td>
                <td>
                    Enter Data here 
                </td>
            </div>
        </tr>
    </table>
</component> 

I have used WAVE/AXE/Lighthouse to validate the HTML structure of the Table and it seems to be working fine.

Is there any issue if my layout engine creates a few additional divs inside the table HTML? My layout engine creates a div between the tr and td elements. Are there any issues that can arise from this with respect to accessibility standpoint?

2 Answers

You can use <div role="row"> instead tag <tr>. Link to Accessible Rich Internet Applications (WAI-ARIA) 1.1. Row role

<component>
     <div role="table">
        <div role="row"> 
            <span role="columnheader">
                Enter Data here 
            </span>
            <span role="columnheader">
                Enter Data here 
            </span>
        </div>
        <div role="row"> 
            <span role="cell">
                Enter Data here 
            </span>
            <span role="cell">
                Enter Data here 
            </span>
        </div>
        <div role="row"> 
            <span role="cell">
                Enter Data here 
            </span>
            <span role="cell">
                Enter Data here 
            </span>
        </div>
    </div>
</component> 
Related