Skip to content

Conversation

@ivanmartynau-oss
Copy link

@ivanmartynau-oss ivanmartynau-oss commented Nov 3, 2025

Description

We do have a11y Audit, some of the issues in this audit connected with Trino
This PR is created to fix those. We have to add couple of properties to improve readability of voice readers

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.

## Section
* Improve a11y for ClusterHUD. ({[SEP-18317](https://starburstdata.atlassian.net/browse/SEP-18317)}`18317`)

Summary by Sourcery

Enhance web UI accessibility by adding ARIA attributes and keyboard focus to charts and updating image/link labels.

Enhancements:

  • Apply ARIA labels, roles, and IDs to sparkline chart canvases to expose current metric values to screen readers
  • Add tabindex, aria-label, and aria-describedby attributes to chart label spans for keyboard and assistive technology support
  • Add alt text to the logo image and an aria-label to the homepage link for better link description

Add proper navigation. Add proper readability for canvas and link
Add propeties for better readability in the voice reader

Add proper navigation. Add proper readability for canvas and link
@cla-bot
Copy link

cla-bot bot commented Nov 3, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 3, 2025

Reviewer's Guide

This PR enhances the accessibility of the Trino Web UI by adding ARIA attributes to sparkline charts, HUD metric labels, and the logo link to improve screen reader readability.

File-Level Changes

Change Details Files
Add ARIA attributes to sparkline chart canvases
  • Attach aria-label with metric name and current value
  • Set role="img" on each canvas
  • Assign unique id to each chart element
core/trino-web-ui/src/main/resources/webapp/src/components/ClusterHUD.jsx
Enhance HUD metric labels for screen readers
  • Add tabIndex="0" to make labels focusable
  • Include aria-label summarizing each metric
  • Link labels to charts via aria-describedby
core/trino-web-ui/src/main/resources/webapp/src/components/ClusterHUD.jsx
Improve accessibility of the page title logo
  • Add aria-label to the home page link
  • Provide alt text on the logo image
core/trino-web-ui/src/main/resources/webapp/src/components/PageTitle.jsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the ui Web UI label Nov 3, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `core/trino-web-ui/src/main/resources/webapp/src/components/ClusterHUD.jsx:150-151` </location>
<code_context>
                 $.extend({}, SPARKLINE_PROPERTIES, { chartRangeMin: 0 })
             )
+            // Apply ARIA attributes to the generated canvas
+            $('#running-queries-sparkline canvas').attr({
+                'aria-label': `Running queries over time. Current value: ${this.state.runningQueries[this.state.runningQueries.length - 1]} queries`,
+                'role': 'img',
+                'id': 'running-queries-chart'
</code_context>

<issue_to_address>
**issue:** Consider handling empty data arrays to avoid undefined values in ARIA labels.

Accessing the last element of an empty array returns 'undefined', which may be read incorrectly by screen readers. Use a default value like 0 when the array is empty.
</issue_to_address>

### Comment 2
<location> `core/trino-web-ui/src/main/resources/webapp/src/components/ClusterHUD.jsx:153-154` </location>
<code_context>
+            $('#running-queries-sparkline canvas').attr({
+                'aria-label': `Running queries over time. Current value: ${this.state.runningQueries[this.state.runningQueries.length - 1]} queries`,
+                'role': 'img',
+                'id': 'running-queries-chart'
+            })
             $('#blocked-queries-sparkline').sparkline(
                 this.state.blockedQueries,
</code_context>

<issue_to_address>
**issue (bug_risk):** Using static IDs for multiple charts may cause DOM conflicts.

Using a static 'id' for each chart's canvas can result in duplicate IDs if multiple ClusterHUD instances are rendered. Use a unique ID per instance or remove the 'id' if it's not required.
</issue_to_address>

### Comment 3
<location> `core/trino-web-ui/src/main/resources/webapp/src/components/ClusterHUD.jsx:268-269` </location>
<code_context>
                                     data-toggle="tooltip"
                                     data-placement="right"
                                     title="Total number of queries currently running"
+                                    tabIndex="0"
+                                    aria-label="Running queries - Total number of queries currently running"
+                                    aria-describedby="running-queries-chart"
                                 >
</code_context>

<issue_to_address>
**suggestion:** tabIndex="0" may affect keyboard navigation order.

Evaluate if each span should be focusable, as excessive use of tabIndex="0" can make keyboard navigation cumbersome. Limit focusable elements to those that require user interaction.

Suggested implementation:

```javascript
                                    data-toggle="tooltip"
                                    data-placement="right"
                                    title="Total number of queries currently running"
                                    aria-label="Running queries - Total number of queries currently running"
                                    aria-describedby="running-queries-chart"
                                >

```

```javascript
                                    data-toggle="tooltip"
                                    data-placement="right"
                                    title="Total number of active worker nodes"
                                    aria-label="Active workers - Total number of active worker nodes"
                                    aria-describedby="active-workers-chart"
                                >

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +150 to +151
$('#running-queries-sparkline canvas').attr({
'aria-label': `Running queries over time. Current value: ${this.state.runningQueries[this.state.runningQueries.length - 1]} queries`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Consider handling empty data arrays to avoid undefined values in ARIA labels.

Accessing the last element of an empty array returns 'undefined', which may be read incorrectly by screen readers. Use a default value like 0 when the array is empty.

Comment on lines +153 to +154
'id': 'running-queries-chart'
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Using static IDs for multiple charts may cause DOM conflicts.

Using a static 'id' for each chart's canvas can result in duplicate IDs if multiple ClusterHUD instances are rendered. Use a unique ID per instance or remove the 'id' if it's not required.

Comment on lines +268 to +269
tabIndex="0"
aria-label="Running queries - Total number of queries currently running"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: tabIndex="0" may affect keyboard navigation order.

Evaluate if each span should be focusable, as excessive use of tabIndex="0" can make keyboard navigation cumbersome. Limit focusable elements to those that require user interaction.

Suggested implementation:

                                    data-toggle="tooltip"
                                    data-placement="right"
                                    title="Total number of queries currently running"
                                    aria-label="Running queries - Total number of queries currently running"
                                    aria-describedby="running-queries-chart"
                                >
                                    data-toggle="tooltip"
                                    data-placement="right"
                                    title="Total number of active worker nodes"
                                    aria-label="Active workers - Total number of active worker nodes"
                                    aria-describedby="active-workers-chart"
                                >

@chenjian2664
Copy link
Contributor

@ivanmartynau-oss Hi, could you remove the jira link in the release note, it’s not really helpful for open-source folks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui Web UI

Development

Successfully merging this pull request may close these issues.

2 participants