@cahyo-dimas/freeday 1.51.1 → 1.52.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
3
3
  Semua perubahan penting dicatat di sini. Format longgar mengikuti
4
4
  [Keep a Changelog](https://keepachangelog.com/); tiap versi = git tag.
5
5
 
6
+ ## [1.52.0] — 2026-08-24
7
+ ### Fixed
8
+ - **A chart's legend, bar values and donut centre were exposed to assistive tech after all** (#047).
9
+ `COMPONENTS.md` explained the a11y contract with the ARIA spec — `role="img"` is *Children
10
+ Presentational*, therefore "rendered bar values, axis ticks and legends are not exposed". Measured
11
+ against Chrome's accessibility tree, that is not what happens: a donut kept `list` → three
12
+ `listitem` → `StaticText "posted — 76%"` and its centre total `1687`, the legacy `.fdy-bars` kept
13
+ every value and label (`12`, `Jan`, `30`, `Feb`…), and a two-series cartesian kept its legend — all
14
+ live, none ignored. What actually protected the advice was only that AT treats a *named*
15
+ `role="img"` as a leaf and does not descend; the docs presented a habit as a guarantee. Axis ticks
16
+ were the one true claim, and for an unstated reason: the renderer already sets `aria-hidden` on the
17
+ `<svg>` itself.
18
+ `ensureImg()` now marks the rendered children `aria-hidden="true"`, so the author's `aria-label`
19
+ really is the entire text alternative and cannot be double-announced by an AT that does descend.
20
+ Nothing is removed and nothing moves — the legend and the centre are still in the DOM and still
21
+ painted.
22
+ - **The hiding requires a name.** A chart with no `aria-label`/`aria-labelledby` keeps its contents
23
+ exposed: pruning the subtree of an unlabelled chart would leave an image with no name *and* no
24
+ text, which is worse than the leak and harder for the author to notice. An element whose author
25
+ set some other `role` is left alone entirely.
26
+ ### Docs
27
+ - The Charts a11y bullet now describes the kit instead of the spec: what is hidden, that `role="img"`
28
+ alone would not have hidden it, and what happens when the label is missing.
29
+ ### Added — guards
30
+ - `browser/chart-a11y.mjs` (5 tests) over donut, legacy bars and cartesian: the accessible subtree
31
+ exposes no text of its own, the author label survives as the name, the legend is still rendered and
32
+ visible (hidden, not deleted), and an unlabelled chart still reads. The first three were verified to
33
+ fail against 1.51.1.
34
+ - `axSubtree()` in the browser harness — every AX node under an element, ignored ones included. The
35
+ DOM cannot answer this class of question: `aria-hidden` changes no markup, so a `querySelector`
36
+ assert passes identically before and after the fix. Same reason the 1.51.0 scaling bug needed a
37
+ real measurement rather than a source read.
38
+
6
39
  ## [1.51.1] — 2026-08-24
7
40
  ### Docs
8
41
  - **`COMPONENTS.md` never said whether two overlays may be open at once** (#046). Modal and Drawer
package/COMPONENTS.md CHANGED
@@ -868,9 +868,14 @@ Pure SVG/CSS, no dependency, re-colours with the theme. Needs `freeday-chart.js`
868
868
  many x-labels fit. Set the token rather than `font-size` on `__tick`/`__xlabel`, or the gutter and
869
869
  the autoskip will still be computed from the old size.
870
870
  - A11y: every chart is `role="img"` + an **author-supplied** `aria-label`, and that label is the
871
- *entire* text alternative — write one that carries the numbers, not just the shape. `role="img"`
872
- makes descendants presentational, so rendered bar values, axis ticks and legends are not exposed
873
- either; any `<table>`/text placed inside the element is **pre-render only** and is replaced on
871
+ *entire* text alternative — write one that carries the numbers, not just the shape. The renderer
872
+ marks everything it draws `aria-hidden="true"` legend, bar values and labels, donut centre, the
873
+ SVG so nothing inside the chart competes with your label or repeats it. `role="img"` alone would
874
+ **not** have done that: it is Children Presentational per ARIA, but browsers keep the subtree in
875
+ the accessibility tree anyway, so the kit hides it rather than relying on the spec. That hiding
876
+ needs a name to work from — a chart with **no** `aria-label`/`aria-labelledby` keeps its contents
877
+ exposed, because an image with neither a name nor any text is worse than one that leaks its
878
+ legend. Any `<table>`/text placed inside the element is **pre-render only** and is replaced on
874
879
  render. Good: `aria-label="Monthly posting trend: Posted 62% → 88%, Draft 24% → 16%"`.
875
880
  - Internal parts (set by JS, useful for overrides): `.fdy-chart__legend` (+`--row`) `__swatch`
876
881
  `__tip`; `.fdy-bars__col` `__bar` `__track` `__label` `__val`; `.fdy-chart-xy__plot` `__grid`
package/README.id.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > **Lebih banyak _free day_ buat dev — UI kit-nya sudah siap pakai.**
6
6
 
7
7
  [![Live docs](https://img.shields.io/badge/docs-live-2050d8?style=flat-square)](https://cahyo-dimas.github.io/freeday-ui-kit/)
8
- [![Release](https://img.shields.io/badge/release-v1.51.1-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.51.1)
8
+ [![Release](https://img.shields.io/badge/release-v1.52.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.52.0)
9
9
 
10
10
  UI KIT yang token-driven & framework-agnostic — satu sumber kebenaran untuk warna, tipografi,
11
11
  spasi, dan komponen. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > **More free days for devs — the UI kit is ready to use.**
6
6
 
7
7
  [![Live docs](https://img.shields.io/badge/docs-live-2050d8?style=flat-square)](https://cahyo-dimas.github.io/freeday-ui-kit/)
8
- [![Release](https://img.shields.io/badge/release-v1.51.1-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.51.1)
8
+ [![Release](https://img.shields.io/badge/release-v1.52.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v1.52.0)
9
9
 
10
10
  A token-driven, framework-agnostic UI kit — one source of truth for color, typography,
11
11
  spacing, and components. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
@@ -49,7 +49,21 @@
49
49
  var v = el.getAttribute(attr);
50
50
  return v ? v.split(',').map(function (s) { return s.trim(); }) : [];
51
51
  }
52
- function ensureImg(el) { if (!el.hasAttribute('role')) el.setAttribute('role', 'img'); }
52
+ // role="img" is Children Presentational per ARIA, so the docs used to say a chart's rendered
53
+ // legend, bar values and donut centre are not exposed. No browser actually prunes that subtree —
54
+ // measured in Chrome's AX tree, every one of those nodes is live and unignored; what saves the
55
+ // advice is only that AT treats a NAMED role="img" as a leaf and does not descend. So the kit
56
+ // hides them itself, and the author's aria-label really is the whole text alternative.
57
+ //
58
+ // Only for a chart that HAS a name: hiding the contents of an unlabelled one would leave an image
59
+ // with no text at all, which is worse than the leak. An author who sets some other role owns the
60
+ // subtree and gets no help from here.
61
+ function ensureImg(el) {
62
+ if (!el.hasAttribute('role')) el.setAttribute('role', 'img');
63
+ if (el.getAttribute('role') !== 'img') return;
64
+ if (!el.hasAttribute('aria-label') && !el.hasAttribute('aria-labelledby')) return;
65
+ Array.prototype.forEach.call(el.children, function (child) { child.setAttribute('aria-hidden', 'true'); });
66
+ }
53
67
  function svgEl(name) { return document.createElementNS(NS, name); }
54
68
 
55
69
  // Cartesian charts size their viewBox to the measured plot, so a width change needs a repaint.
package/dist/freeday.js CHANGED
@@ -913,7 +913,21 @@
913
913
  var v = el.getAttribute(attr);
914
914
  return v ? v.split(',').map(function (s) { return s.trim(); }) : [];
915
915
  }
916
- function ensureImg(el) { if (!el.hasAttribute('role')) el.setAttribute('role', 'img'); }
916
+ // role="img" is Children Presentational per ARIA, so the docs used to say a chart's rendered
917
+ // legend, bar values and donut centre are not exposed. No browser actually prunes that subtree —
918
+ // measured in Chrome's AX tree, every one of those nodes is live and unignored; what saves the
919
+ // advice is only that AT treats a NAMED role="img" as a leaf and does not descend. So the kit
920
+ // hides them itself, and the author's aria-label really is the whole text alternative.
921
+ //
922
+ // Only for a chart that HAS a name: hiding the contents of an unlabelled one would leave an image
923
+ // with no text at all, which is worse than the leak. An author who sets some other role owns the
924
+ // subtree and gets no help from here.
925
+ function ensureImg(el) {
926
+ if (!el.hasAttribute('role')) el.setAttribute('role', 'img');
927
+ if (el.getAttribute('role') !== 'img') return;
928
+ if (!el.hasAttribute('aria-label') && !el.hasAttribute('aria-labelledby')) return;
929
+ Array.prototype.forEach.call(el.children, function (child) { child.setAttribute('aria-hidden', 'true'); });
930
+ }
917
931
  function svgEl(name) { return document.createElementNS(NS, name); }
918
932
 
919
933
  // Cartesian charts size their viewBox to the measured plot, so a width change needs a repaint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cahyo-dimas/freeday",
3
- "version": "1.51.1",
3
+ "version": "1.52.0",
4
4
  "description": "Freeday — token-driven, framework-agnostic UI KIT (design source-of-truth).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -92,7 +92,7 @@
92
92
  "scripts": {
93
93
  "build": "node tokens/build.mjs",
94
94
  "test": "node --test",
95
- "test:browser": "node --test browser/vanilla.mjs browser/adapter.mjs browser/layout.mjs browser/theme.mjs browser/state.mjs browser/root-init.mjs browser/upload-states.mjs browser/number.mjs browser/card-stretch.mjs browser/text-override.mjs browser/control-heights.mjs browser/cfl-multi.mjs browser/crowding.mjs browser/over-dialog.mjs browser/chart-scale.mjs browser/overlay-stack.mjs",
95
+ "test:browser": "node --test browser/vanilla.mjs browser/adapter.mjs browser/layout.mjs browser/theme.mjs browser/state.mjs browser/root-init.mjs browser/upload-states.mjs browser/number.mjs browser/card-stretch.mjs browser/text-override.mjs browser/control-heights.mjs browser/cfl-multi.mjs browser/crowding.mjs browser/over-dialog.mjs browser/chart-scale.mjs browser/overlay-stack.mjs browser/chart-a11y.mjs",
96
96
  "prepack": "node tokens/build.mjs",
97
97
  "version": "node tokens/build.mjs && git add dist",
98
98
  "typecheck:react": "tsc -p adapters/react/tsconfig.json --noEmit"