| @@ -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 | /** |
| @@ -137,8 +139,25 @@ | ||
| 137 | 139 | return esc_html( $item['id'] ); |
| 138 | 140 | } |
| 139 | 141 | |
| 140 | 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'] ); | |
| 157 | + } | |
| 158 | + | |
| 159 | + /** | |
| 141 | 160 | * Renders a cell in the "table_name" column. |
| 142 | 161 | * |
| 143 | 162 | * @since 1.0.0 |
| 144 | 163 | * |
| @@ -175,9 +194,9 @@ | ||
| 175 | 194 | * @param array<string, mixed> $item Data item for the current row. |
| 176 | 195 | * @return string HTML content of the cell. |
| 177 | 196 | */ |
| 178 | 197 | protected function column_table_action( array $item ): string { |
| 179 | - return '<input type="button" class="insert-shortcode button" title="' . esc_attr( '[' . TablePress::$shortcode . " id={$item['id']} /]" ) . '" value="' . esc_attr__( 'Insert Shortcode', 'tablepress' ) . '">'; | |
| 198 | + return '<input type="button" class="insert-shortcode button button-compact" title="' . esc_attr( '[' . TablePress::$shortcode . " id={$item['id']} /]" ) . '" value="' . esc_attr__( 'Insert Shortcode', 'tablepress' ) . '">'; | |
| 180 | 199 | } |
| 181 | 200 | |
| 182 | 201 | /** |
| 183 | 202 | * Holds the message to be displayed when there are no items in the table. |