From f87d4e672a486ae48751ceb782768cf6afa2a086 Mon Sep 17 00:00:00 2001 From: ahuseyn Date: Fri, 14 Nov 2025 17:02:14 +0100 Subject: [PATCH 1/2] accessibility fixes --- .../assets/css/view/wp-graphql-logging-view.css | 6 +++++- .../assets/js/settings/wp-graphql-logging-settings.js | 6 ++++-- .../src/Admin/Settings/Fields/Field/SelectField.php | 1 + .../wpgraphql-logging/src/Admin/View/List/ListTable.php | 8 +++++--- .../src/Admin/View/Templates/WPGraphQLLoggerFilters.php | 2 +- .../src/Admin/View/Templates/WPGraphQLLoggerView.php | 6 +++--- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/plugins/wpgraphql-logging/assets/css/view/wp-graphql-logging-view.css b/plugins/wpgraphql-logging/assets/css/view/wp-graphql-logging-view.css index 07545139..1893d14e 100644 --- a/plugins/wpgraphql-logging/assets/css/view/wp-graphql-logging-view.css +++ b/plugins/wpgraphql-logging/assets/css/view/wp-graphql-logging-view.css @@ -9,8 +9,12 @@ .wpgraphql-logging-details pre.wpgraphql-logging-context, .wpgraphql-logging-details pre.wpgraphql-logging-extra { white-space: pre-wrap; + word-wrap: break-word; + word-break: break-word; + overflow-wrap: break-word; max-height: 540px; - overflow-y: scroll; + overflow-y: auto; + overflow-x: auto; padding: 15px; border: 1px solid #ddd; border-radius: 4px; diff --git a/plugins/wpgraphql-logging/assets/js/settings/wp-graphql-logging-settings.js b/plugins/wpgraphql-logging/assets/js/settings/wp-graphql-logging-settings.js index b6b18778..d44ce01d 100644 --- a/plugins/wpgraphql-logging/assets/js/settings/wp-graphql-logging-settings.js +++ b/plugins/wpgraphql-logging/assets/js/settings/wp-graphql-logging-settings.js @@ -63,10 +63,11 @@ document.addEventListener("DOMContentLoaded", function () { ); function checkLogPointsSelection() { + const descriptionId = "log-points-description"; const anyLogPointsSelected = logPointsInput.selectedOptions.length > 0; const existingDescription = - logPointsInput.parentElement.querySelector(".description"); + logPointsInput.parentElement.querySelector(`#${descriptionId}`); if (existingDescription) { existingDescription.remove(); } @@ -75,8 +76,9 @@ document.addEventListener("DOMContentLoaded", function () { if (enableCheckbox?.checked && !anyLogPointsSelected) { const description = document.createElement("p"); - if (!logPointsInput.parentElement.querySelector(".description")) { + if (!logPointsInput.parentElement.querySelector(`#${descriptionId}`)) { description.className = "description"; + description.id = descriptionId; description.textContent = "If you don't select any log points, no data will be logged."; description.style.marginLeft = "25px"; diff --git a/plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/SelectField.php b/plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/SelectField.php index ffa821e9..c6d37fc6 100644 --- a/plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/SelectField.php +++ b/plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/SelectField.php @@ -61,6 +61,7 @@ public function render_field( array $option_value, string $setting_key, string $ $html .= 'name="' . esc_attr( $field_name ) . ( $this->multiple ? '[]' : '' ) . '" '; $html .= 'id="' . esc_attr( $this->get_id() ) . '" '; $html .= 'class="' . esc_attr( $this->css_class ) . '" '; + $html .= 'aria-labelledby="' . esc_attr( $field_name ) . '-tooltip" '; if ( $this->multiple ) { $html .= 'multiple="multiple" '; diff --git a/plugins/wpgraphql-logging/src/Admin/View/List/ListTable.php b/plugins/wpgraphql-logging/src/Admin/View/List/ListTable.php index 7ad25ec4..4bc34181 100644 --- a/plugins/wpgraphql-logging/src/Admin/View/List/ListTable.php +++ b/plugins/wpgraphql-logging/src/Admin/View/List/ListTable.php @@ -280,9 +280,11 @@ public function column_cb( $item ): string { if ( ! $item instanceof WordPressDatabaseEntity ) { return ''; } + $log_id = $item->get_id(); return sprintf( - '', - $item->get_id() + '', + $item->get_id(), + sprintf( __( 'Select log entry %d', 'wpgraphql-logging' ), $log_id ) ); } @@ -413,7 +415,7 @@ protected function format_code(string $code): string { if ( empty( $code ) ) { return ''; } - return '
' . esc_html( $code ) . '
'; + return '
' . esc_html( $code ) . '
'; } /** diff --git a/plugins/wpgraphql-logging/src/Admin/View/Templates/WPGraphQLLoggerFilters.php b/plugins/wpgraphql-logging/src/Admin/View/Templates/WPGraphQLLoggerFilters.php index ed71f7c5..25fb6a7f 100644 --- a/plugins/wpgraphql-logging/src/Admin/View/Templates/WPGraphQLLoggerFilters.php +++ b/plugins/wpgraphql-logging/src/Admin/View/Templates/WPGraphQLLoggerFilters.php @@ -37,7 +37,7 @@ class="wpgraphql-logging-datepicker" value="" autocomplete="off" /> -