billboard.js icon indicating copy to clipboard operation
billboard.js copied to clipboard

[Question] Bar Chart Accessibility Question

Open Jeong-tak opened this issue 3 years ago โ€ข 4 comments

Description

์•ˆ๋…•ํ•˜์„ธ์š”. ํ˜„ ํ”„๋กœ์ ํŠธ์—์„œ ๋นŒ๋ณด๋“œ์ฐจํŠธ JS๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ๊ฐœ๋ฐœ์ž์ž…๋‹ˆ๋‹ค. ์œ ์šฉํ•œ ๋นŒ๋ณด๋“œJS ๋•๋ถ„์— ์‰ฝ๊ณ  ๊ฐ„ํŽธํ•˜๊ฒŒ ๊ทธ๋ž˜ํ”„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ํ•œ๊ฐ€์ง€ ๋ฌธ์ œ์ ์ด ๋ฐœ์ƒํ•˜์—ฌ ๋ฌธ์˜๋ฅผ ๋“œ๋ฆฌ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ ‘๊ทผ์„ฑ ๊ด€๋ จ ๋ฌธ์ œ์ธ๋ฐ์š”, ์ œ๊ฐ€ ๊ตฌํ˜„ํ•œ ์ฐจํŠธ๋Š” ๊ฐ€๋กœ Bar Chart์ด๋ฉฐ, 5๊ฐœ์˜ ์นดํ…Œ๊ณ ๋ฆฌ์— ๊ฐ๊ฐ 2๊ฐœ์˜ ๋ฐ์ดํ„ฐ(data1, data2)๋กœ ๊ตฌ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ iOS ๊ธฐ์ค€ VoiceOver ์‚ฌ์šฉ ์‹œ, ํฌ์ปค์Šค์˜ ํ๋ฆ„์ด ๋ฐ” > ํ•ด๋‹น ๊ฐ’ > ๋ฐ” > ํ•ด๋‹น ๊ฐ’ > ๋ฐ” > ํ•ด๋‹น ๊ฐ’์ด ์•„๋‹Œ ๋ฐ” > ๋ฐ” > ๋ฐ” > ๋ฐ” > ๋ฐ” > ๊ฐ’ > ๊ฐ’ > ๊ฐ’ > ๊ฐ’.. ์˜ ํ๋ฆ„์œผ๋กœ ์ง„ํ–‰๋˜์–ด ์ ‘๊ทผ์„ฑ์ด ์ œ๋Œ€๋กœ ์ง€์ผœ์ง€์ง€ ์•Š๋Š” ์ƒํ™ฉ์ž…๋‹ˆ๋‹ค.

ํ˜น์‹œ ํ•ด๋‹น ์ฐจํŠธ์˜ ๊ฐ ๊ตฌ์„ฑ ์ด๋ฏธ์ง€(๋ฐ์ดํ„ฐ)๋“ค์˜ ํฌ์ปค์Šค ์ˆœ์„œ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ๋Š”์ง€ ๋ฌธ์˜๋“œ๋ฆฝ๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์ฐจํŠธ์ด๋ฏธ์ง€๋ฅผ ๋Œ€์ฒดํ•  ์ˆ˜ ์žˆ๋Š” ํ‘œ ๋“ฑ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ž๋™์œผ๋กœ ๊ทธ๋ ค์ฃผ๋Š” ๊ธฐ๋Šฅ์ด ์žˆ๋Š”์ง€๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

Jeong-tak avatar Aug 10 '21 02:08 Jeong-tak

Hi @Awaken-Cq, you can check working example from:

  • https://jsfiddle.net/netil/4na2emyq/

A18y

For a18y, you can set manually tabindex attribute in order according how the focus will flow. If want flow. as bar -> data label .... order, you can do as:

  onafterinit: function() {
	const {bar: {bars}, text: {texts}} = this.$;
	const textNodes = texts.nodes();
	let seq = 0;
	let idx = 1;

	bars.each(function(d, i) {
		this.setAttribute("tabindex", idx++);
		textNodes[seq++].setAttribute("tabindex", idx++);
	});

Table view

Table view plugin is already implemented(#2188), but not officially released yet. You can use @next tagged version for now.

$ npm install billboard.js@next
  1. Load necessary files
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/billboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/plugin/billboardjs-plugin-tableview.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/billboard.min.css
  1. Specify tableview plugin options
  plugins: [
    new bb.plugin.tableview({
     title: "My Yearly Data List",
     categoryTitle: "Year",
     style: true
    }),
  ]

netil avatar Aug 11 '21 07:08 netil

I have a follow-up question to the solution above. Is there any way to trigger tooltip.show when a bar is focused?

In other words, show tooltip when focusing a bar, circle or any other point that would trigger the tooltip on mouseover.

adamfagerstrom avatar Oct 21 '22 18:10 adamfagerstrom

@adamfagerstrom, checkout the example

  • https://jsfiddle.net/netil/7q62o54s/

focus

netil avatar Oct 24 '22 02:10 netil

That will do the trick, thank you @netil

Will these eventListners that's being created on each node be removed with the chart.destroy() aswell? Or do i manually need to remove them?

adamfagerstrom avatar Oct 27 '22 12:10 adamfagerstrom