| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | * @author Tobias Bäthge |
| 8 | 8 | * @since 2.0.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +declare(strict_types=1); | |
| 12 | + | |
| 11 | 13 | // Prohibit direct script loading. |
| 12 | 14 | defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 13 | 15 | |
| 14 | 16 | /** |
| @@ -134,8 +136,25 @@ | ||
| 134 | 136 | * @return string HTML content of the cell. |
| 135 | 137 | */ |
| 136 | 138 | protected function column_table_id( array $item ): string { |
| 137 | 139 | return esc_html( $item['id'] ); |
| 140 | + } | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * Returns a clean label for the primary (Table Name) column's row header `aria-label`. | |
| 144 | + * | |
| 145 | + * Provides screen readers with just the table name as the row header name, | |
| 146 | + * preventing them from computing the name from the full cell content. | |
| 147 | + * | |
| 148 | + * @since 3.3.4 | |
| 149 | + * | |
| 150 | + * @param array<string, mixed> $item Data item for the current row. | |
| 151 | + * @return string The table name. | |
| 152 | + */ | |
| 153 | + protected function get_primary_column_aria_label( /* array */ $item ): string { | |
| 154 | + // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. | |
| 155 | + | |
| 156 | + return trim( $item['name'] ); | |
| 138 | 157 | } |
| 139 | 158 | |
| 140 | 159 | /** |
| 141 | 160 | * Renders a cell in the "table_name" column. |