Skip to content

Commit 9f64f5a

Browse files
authored
ariaLabel, ariaDescription, ariaHidden (#710)
* ariaLabel, ariaDescription * aria-description, not desc * ariaHidden
1 parent 16dbbc9 commit 9f64f5a

File tree

166 files changed

+1215
-1174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+1215
-1174
lines changed

src/axis.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export class AxisX {
6565
const offsetSign = axis === "top" ? -1 : 1;
6666
const ty = offsetSign * offset + (axis === "top" ? marginTop : height - marginBottom);
6767
return create("svg:g")
68+
.attr("aria-label", `${this.name}-axis`)
6869
.attr("transform", `translate(0,${ty})`)
6970
.call(createAxis(axis === "top" ? axisTop : axisBottom, x, this))
7071
.call(maybeTickRotate, tickRotate)
@@ -150,6 +151,7 @@ export class AxisY {
150151
const offsetSign = axis === "left" ? -1 : 1;
151152
const tx = offsetSign * offset + (axis === "right" ? width - marginRight : marginLeft);
152153
return create("svg:g")
154+
.attr("aria-label", `${this.name}-axis`)
153155
.attr("transform", `translate(${tx},0)`)
154156
.call(createAxis(axis === "right" ? axisRight : axisLeft, y, this))
155157
.call(maybeTickRotate, tickRotate)

src/marks/area.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {maybeIdentityX, maybeIdentityY} from "../transforms/identity.js";
88
import {maybeStackX, maybeStackY} from "../transforms/stack.js";
99

1010
const defaults = {
11+
ariaLabel: "area",
1112
strokeWidth: 1,
1213
strokeMiterlimit: 1
1314
};

src/marks/arrow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransfo
55
import {maybeSameValue} from "./link.js";
66

77
const defaults = {
8+
ariaLabel: "arrow",
89
fill: "none",
910
stroke: "currentColor",
1011
strokeLinecap: "round",

src/marks/bar.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import {maybeIdentityX, maybeIdentityY} from "../transforms/identity.js";
77
import {maybeIntervalX, maybeIntervalY} from "../transforms/interval.js";
88
import {maybeStackX, maybeStackY} from "../transforms/stack.js";
99

10-
const defaults = {};
11-
1210
export class AbstractBar extends Mark {
13-
constructor(data, channels, options = {}) {
11+
constructor(data, channels, options = {}, defaults) {
1412
super(data, channels, options, defaults);
1513
const {inset = 0, insetTop = inset, insetRight = inset, insetBottom = inset, insetLeft = inset, rx, ry} = options;
1614
this.insetTop = number(insetTop);
@@ -58,6 +56,10 @@ export class AbstractBar extends Mark {
5856
}
5957
}
6058

59+
const defaults = {
60+
ariaLabel: "bar"
61+
};
62+
6163
export class BarX extends AbstractBar {
6264
constructor(data, options = {}) {
6365
const {x1, x2, y} = options;
@@ -68,7 +70,8 @@ export class BarX extends AbstractBar {
6870
{name: "x2", value: x2, scale: "x"},
6971
{name: "y", value: y, scale: "y", type: "band", optional: true}
7072
],
71-
options
73+
options,
74+
defaults
7275
);
7376
}
7477
_transform(selection, {x}, dx, dy) {
@@ -94,7 +97,8 @@ export class BarY extends AbstractBar {
9497
{name: "y2", value: y2, scale: "y"},
9598
{name: "x", value: x, scale: "x", type: "band", optional: true}
9699
],
97-
options
100+
options,
101+
defaults
98102
);
99103
}
100104
_transform(selection, {y}, dx, dy) {

src/marks/cell.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import {identity, indexOf, maybeColorChannel, maybeTuple} from "../options.js";
22
import {AbstractBar} from "./bar.js";
33

4+
const defaults = {
5+
ariaLabel: "cell"
6+
};
7+
48
export class Cell extends AbstractBar {
59
constructor(data, {x, y, ...options} = {}) {
610
super(
@@ -9,7 +13,8 @@ export class Cell extends AbstractBar {
913
{name: "x", value: x, scale: "x", type: "band", optional: true},
1014
{name: "y", value: y, scale: "y", type: "band", optional: true}
1115
],
12-
options
16+
options,
17+
defaults
1318
);
1419
}
1520
_transform() {

src/marks/dot.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Mark} from "../plot.js";
55
import {applyChannelStyles, applyDirectStyles, applyFrameAnchor, applyIndirectStyles, applyTransform, offset} from "../style.js";
66

77
const defaults = {
8+
ariaLabel: "dot",
89
fill: "none",
910
stroke: "currentColor",
1011
strokeWidth: 1.5

src/marks/frame.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {number} from "../options.js";
44
import {applyDirectStyles, applyIndirectStyles, applyTransform, offset} from "../style.js";
55

66
const defaults = {
7+
ariaLabel: "frame",
78
fill: "none",
89
stroke: "currentColor"
910
};

src/marks/image.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Mark} from "../plot.js";
55
import {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform, applyAttr, offset, impliedString, applyFrameAnchor} from "../style.js";
66

77
const defaults = {
8+
ariaLabel: "image",
89
fill: null,
910
stroke: null
1011
};

src/marks/line.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {indexOf, identity, maybeTuple, maybeZ} from "../options.js";
66
import {applyDirectStyles, applyIndirectStyles, applyTransform, applyGroupedChannelStyles, offset} from "../style.js";
77

88
const defaults = {
9+
ariaLabel: "line",
910
fill: "none",
1011
stroke: "currentColor",
1112
strokeWidth: 1.5,

src/marks/link.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {Mark} from "../plot.js";
44
import {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform, offset} from "../style.js";
55

66
const defaults = {
7+
ariaLabel: "link",
78
fill: "none",
89
stroke: "currentColor",
910
strokeMiterlimit: 1

0 commit comments

Comments
 (0)