@cfasim-ui/docs 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -701,11 +701,11 @@ anchor. `lineColor`, `lineWidth`, and `lineDash` style the line.
701
701
 
702
702
  ## Accessibility
703
703
 
704
- The chart's individual bars aren't exposed to assistive tech, so the chart
705
- announces itself with a single accessible name. When the chart has a `title`,
706
- its root element gets `role="figure"` and an `aria-label` set to the title, so
707
- screen readers announce it as a labeled figure while the menu and download
708
- controls stay reachable.
704
+ The chart's `<svg>` is exposed as a single labeled image so screen readers
705
+ announce one accessible name instead of wandering through the individual bars.
706
+ When the chart has a `title`, the `<svg>` gets `role="img"` and an `aria-label`
707
+ set to the title. The menu and download controls live outside the `<svg>`, so
708
+ they stay reachable regardless.
709
709
 
710
710
  Set `ariaLabel` to give screen readers a fuller summary than the visible title
711
711
  (it overrides `title` for the accessible name only):
@@ -719,9 +719,8 @@ Set `ariaLabel` to give screen readers a fuller summary than the visible title
719
719
  />
720
720
  ```
721
721
 
722
- Pass `role` to override the default, e.g. `role="img"` to expose the chart as a
723
- single image (note this hides the inner menu/download controls from assistive
724
- tech).
722
+ Pass `role` to override the default `"img"` (e.g. `role="figure"`, or a role of
723
+ your own).
725
724
 
726
725
  ## API
727
726
 
@@ -286,12 +286,14 @@ const props = withDefaults(defineProps<BarChartProps>(), {
286
286
  valueAxis: true,
287
287
  });
288
288
 
289
- // Accessible name for the whole chart; falls back to the visible title.
289
+ // Accessible name for the chart; falls back to the visible title.
290
290
  const chartAriaLabel = computed(() => props.ariaLabel ?? props.title);
291
- // Label the chart as a figure when it has a name (keeps inner controls
292
- // reachable, unlike role="img"). An explicit `role` prop always wins.
291
+ // Expose the <svg> as a single labeled image so screen readers announce the
292
+ // name instead of wandering through the individual bars. The menu/download
293
+ // controls live outside the <svg>, so they stay reachable. An explicit `role`
294
+ // prop always wins.
293
295
  const chartRole = computed(
294
- () => props.role ?? (chartAriaLabel.value ? "figure" : undefined),
296
+ () => props.role ?? (chartAriaLabel.value ? "img" : undefined),
295
297
  );
296
298
 
297
299
  // The template root is a <Teleport>, so fallthrough attrs (class, style,
@@ -1483,8 +1485,6 @@ const columnHeaders = computed<ColumnHeader[]>(() => {
1483
1485
  class="bar-chart-wrapper"
1484
1486
  :class="{ 'is-fullscreen': isFullscreen }"
1485
1487
  :style="fullscreenStyle"
1486
- :role="chartRole || undefined"
1487
- :aria-label="chartAriaLabel || undefined"
1488
1488
  >
1489
1489
  <ChartMenu
1490
1490
  v-if="menu"
@@ -1495,7 +1495,13 @@ const columnHeaders = computed<ColumnHeader[]>(() => {
1495
1495
  <div class="chart-sr-only" aria-live="polite">
1496
1496
  {{ isFullscreen ? "Chart expanded to fill window" : "" }}
1497
1497
  </div>
1498
- <svg ref="svgRef" :width="width" :height="height">
1498
+ <svg
1499
+ ref="svgRef"
1500
+ :width="width"
1501
+ :height="height"
1502
+ :role="chartRole || undefined"
1503
+ :aria-label="chartAriaLabel || undefined"
1504
+ >
1499
1505
  <!-- title -->
1500
1506
  <text
1501
1507
  v-if="title"
@@ -1115,11 +1115,11 @@ until the user clicks Download:
1115
1115
 
1116
1116
  ## Accessibility
1117
1117
 
1118
- The chart's individual marks aren't exposed to assistive tech, so the chart
1119
- announces itself with a single accessible name. When the chart has a `title`,
1120
- its root element gets `role="figure"` and an `aria-label` set to the title, so
1121
- screen readers announce it as a labeled figure while the menu and download
1122
- controls stay reachable.
1118
+ The chart's `<svg>` is exposed as a single labeled image so screen readers
1119
+ announce one accessible name instead of wandering through the individual marks.
1120
+ When the chart has a `title`, the `<svg>` gets `role="img"` and an `aria-label`
1121
+ set to the title. The menu and download controls live outside the `<svg>`, so
1122
+ they stay reachable regardless.
1123
1123
 
1124
1124
  Set `ariaLabel` to give screen readers a fuller summary than the visible title
1125
1125
  (it overrides `title` for the accessible name only):
@@ -1132,9 +1132,8 @@ Set `ariaLabel` to give screen readers a fuller summary than the visible title
1132
1132
  />
1133
1133
  ```
1134
1134
 
1135
- Pass `role` to override the default, e.g. `role="img"` to expose the chart as a
1136
- single image (note this hides the inner menu/download controls from assistive
1137
- tech).
1135
+ Pass `role` to override the default `"img"` (e.g. `role="figure"`, or a role of
1136
+ your own).
1138
1137
 
1139
1138
  ## Props
1140
1139
 
@@ -240,12 +240,14 @@ const props = withDefaults(defineProps<LineChartProps>(), {
240
240
  yScaleType: "linear",
241
241
  });
242
242
 
243
- // Accessible name for the whole chart; falls back to the visible title.
243
+ // Accessible name for the chart; falls back to the visible title.
244
244
  const chartAriaLabel = computed(() => props.ariaLabel ?? props.title);
245
- // Label the chart as a figure when it has a name (keeps inner controls
246
- // reachable, unlike role="img"). An explicit `role` prop always wins.
245
+ // Expose the <svg> as a single labeled image so screen readers announce the
246
+ // name instead of wandering through the individual marks. The menu/download
247
+ // controls live outside the <svg>, so they stay reachable. An explicit `role`
248
+ // prop always wins.
247
249
  const chartRole = computed(
248
- () => props.role ?? (chartAriaLabel.value ? "figure" : undefined),
250
+ () => props.role ?? (chartAriaLabel.value ? "img" : undefined),
249
251
  );
250
252
 
251
253
  // The template root is a <Teleport>, so fallthrough attrs (class, style,
@@ -1056,8 +1058,6 @@ const positionedLegendItems = computed(() => {
1056
1058
  class="line-chart-wrapper"
1057
1059
  :class="{ 'is-fullscreen': isFullscreen }"
1058
1060
  :style="fullscreenStyle"
1059
- :role="chartRole || undefined"
1060
- :aria-label="chartAriaLabel || undefined"
1061
1061
  >
1062
1062
  <ChartMenu
1063
1063
  v-if="menu"
@@ -1068,7 +1068,13 @@ const positionedLegendItems = computed(() => {
1068
1068
  <div class="chart-sr-only" aria-live="polite">
1069
1069
  {{ isFullscreen ? "Chart expanded to fill window" : "" }}
1070
1070
  </div>
1071
- <svg ref="svgRef" :width="width" :height="totalHeight">
1071
+ <svg
1072
+ ref="svgRef"
1073
+ :width="width"
1074
+ :height="totalHeight"
1075
+ :role="chartRole || undefined"
1076
+ :aria-label="chartAriaLabel || undefined"
1077
+ >
1072
1078
  <!-- title -->
1073
1079
  <text
1074
1080
  v-if="title"
@@ -104,16 +104,16 @@ export interface ChartCommonProps {
104
104
  /** Styling for the chart title. See `TitleStyle`. */
105
105
  titleStyle?: TitleStyle;
106
106
  /**
107
- * ARIA role for the chart's root element. Defaults to `"figure"` when an
108
- * accessible name is present (from `ariaLabel` or `title`), so screen
109
- * readers announce the chart as a labeled figure while its controls (menu,
110
- * download) stay reachable. Pass `"img"` to expose it as a single image
111
- * (which hides the inner controls from assistive tech), or your own role.
107
+ * ARIA role for the chart's `<svg>`. Defaults to `"img"` when an accessible
108
+ * name is present (from `ariaLabel` or `title`), so screen readers announce
109
+ * the chart as a single labeled image instead of exposing the individual
110
+ * marks. The menu and download controls sit outside the `<svg>`, so they
111
+ * stay reachable regardless. Pass your own role to override.
112
112
  */
113
113
  role?: string;
114
114
  /**
115
- * Accessible name for the chart, announced by screen readers via the root
116
- * element's `aria-label`. Defaults to the `title` prop. The individual
115
+ * Accessible name for the chart, announced by screen readers via the
116
+ * `<svg>`'s `aria-label`. Defaults to the `title` prop. The individual
117
117
  * marks aren't exposed to assistive tech, so set this to a short summary of
118
118
  * what the chart shows.
119
119
  */
package/index.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.3",
2
+ "version": "0.6.4",
3
3
  "package": "@cfasim-ui/docs",
4
4
  "content": {
5
5
  "components": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfasim-ui/docs",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "LLM-friendly component and chart documentation for cfasim-ui",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {