vega-lite icon indicating copy to clipboard operation
vega-lite copied to clipboard

Description property for the chart legend does not override the default aria-label

Open MarkMcAmhlaidh opened this issue 9 months ago • 1 comments

Bug Description

Current Behaviour

  • Legend elements always use default aria-label values regardless of the description property being set.
  • Custom accessibility labels, set with the description property are ignored.
  • Localisation of legend text is not possible.

Expected Behavior

  • The description property should properly override default aria-label values. https://vega.github.io/vega-lite/docs/legend.html#properties

Impact

  • Accessibility: Users relying on screen readers cannot understand chart legends in their language
  • Localisation: Cannot provide localised aria-labels international users

Reproduction Steps

  • Create a chart with a legend
  • Set the description property on the legend configuration
  • Inspect the legend elements on your browser
  • You will see that the default values are used instead of the custom description
{
  "$schema": "https://vega.github.io/schema/vega-lite/v6.json",
  "data": {"url": "data/barley.json"},
  "mark": "bar",
  "encoding": {
       "x": {"aggregate": "sum", "field": "yield"},
       "y": {"field": "variety"},
       "color": {
          "field": "site", 
          "legend": {
             "description": "test custom label",
          }
       }
  }
}
Image Image

MarkMcAmhlaidh avatar Jul 16 '25 10:07 MarkMcAmhlaidh

Please add an example in the issue. Also, would you be willing to look into a fix?

domoritz avatar Jul 16 '25 10:07 domoritz