wordpress-admin-style icon indicating copy to clipboard operation
wordpress-admin-style copied to clipboard

[Bug]: Wrong HTML table form.

Open ve3 opened this issue 1 month ago • 0 comments

Description of the bug

Your current example for Table with class form-table is...

<table class="form-table">
    <tbody>
        <tr>
            <th class="row-title">Table header cell #1</th>
            <th>Table header cell #2</th>
        </tr>
        <tr valign="top">
            <td scope="row">
                <label for="tablecell">Table data cell #1, with label</label>
            </td>
            <td>Table Cell #2</td>
        </tr>
        <tr valign="top" class="alternate">
            <td scope="row">
                <label for="tablecell">Table Cell #3, with label and class <code>alternate</code>
                </label>
            </td>
            <td>Table Cell #4</td>
        </tr>
        <tr valign="top">
            <td scope="row">
                <label for="tablecell">Table Cell #5, with label</label>
            </td>
            <td>Table Cell #6</td>
        </tr>
    </tbody>
</table>

And with HTML above, the result is wrong. The column of field name is too wide.

Refer from WordPress Settings page (General Settings), the differents are:

  • You have no role="presentation" on <table> tag. (This is not required but I just refer from settings page.)
  • Form table does not need table header (<tr><th>..</th><th>..</th></tr>).
  • The form row should be use <th> on the field name. Example: <tr><th scope="row">Name</th><td>..</td></tr>. You are currently using <td scope="row">.

Reproduction instructions

  1. Activate plugin.
  2. Go to Admin Style menu from the left.
  3. Click on Tables.

Expected behavior

Expect table form or form table to have narrower field name column like in any Settings pages.

Environment info

  • Plugin v 1.6.1
  • WordPress 6.9-RC2-61274

Relevant log output


Additional context

No response

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

ve3 avatar Nov 24 '25 16:11 ve3