Make WordPress Core

Changeset 63398


Ignore:
Timestamp:
08/30/2026 09:40:15 AM (6 weeks ago)
Author:
afercia
Message:

Administration: Render a table row header in the Application Passwords AJAX row template.

Tables extending WP_List_Table use a <th scope="row"> element as the row
header for the primary column. WP_List_Table::single_row_columns() renders
this for server-generated rows, but the JavaScript template used when a new
application password is created via AJAX rendered every cell as a <td> element,
leaving the row header missing until the page was reloaded.

Renders the primary column of the JavaScript row template as a
<th scope="row"> element, mirroring the server-generated markup.

Props khokansardar, mukesh27, afercia.
See #32892.
Fixes #65707.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-application-passwords-list-table.php

    r57644 r63398  
    215215                        }
    216216
    217                         printf( '<td class="%s" data-colname="%s">', esc_attr( $classes ), esc_attr( wp_strip_all_tags( $display_name ) ) );
     217                        // The primary column is a `<th scope="row">` row header, matching the
     218                        // server-rendered markup in WP_List_Table::single_row_columns().
     219                        $tag   = $is_primary ? 'th' : 'td';
     220                        $scope = $is_primary ? ' scope="row"' : '';
     221
     222                        printf( '<%1$s class="%2$s" data-colname="%3$s"%4$s>', $tag, esc_attr( $classes ), esc_attr( wp_strip_all_tags( $display_name ) ), $scope );
    218223
    219224                        switch ( $column_name ) {
    … …  
    260265                        }
    261266
    262                         echo '</td>';
     267                        echo "</{$tag}>";
    263268                }
    264269
Note: See TracChangeset for help on using the changeset viewer.