Skip to content

add Chart2Music keyboard and sound accessibility features #6680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 82 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
6fb9c65
initial commit, single scatter plot
Jul 21, 2023
87b4c5c
single scatter plot
Jul 21, 2023
64ae505
options and info
Jul 21, 2023
d37d24f
data and trace labels
Jul 21, 2023
d0467bb
false default
Jul 21, 2023
3a73776
remove debugging prints
Jul 21, 2023
b4df959
use index if no x provided
Jul 21, 2023
97b608f
Lib requirement
Jul 22, 2023
6205d62
layout destructuring
Jul 22, 2023
7e40cde
layout defaults
Jul 22, 2023
6d9185b
destructure trace
Jul 22, 2023
935cf54
test sourcetype module
Jul 22, 2023
44deae2
remove sourcetype
Jul 22, 2023
c38ab67
into es5
Jul 28, 2023
c6a27be
include mjs files
Jul 28, 2023
cac174c
transpile accessibility
Jul 30, 2023
159ca1b
accessibility in config
Jul 30, 2023
7467a47
Merge branch 'master' into chart2music
ayjayt Jan 12, 2024
08b820b
Remove special rules from webpack.config:
ayjayt Jan 12, 2024
41b0fb9
Reorder declarations to make a bit more readable
ayjayt Jan 12, 2024
94e25c3
Lint
ayjayt Jan 13, 2024
61ea8ce
Change import/export scheme to promise
ayjayt Jan 17, 2024
c9a0b91
Remove a console.log
ayjayt Jan 17, 2024
cc92639
Limit chunks to 1
ayjayt Jan 17, 2024
7baa0d3
Upgrade chart2music to support commonjs
ayjayt Jan 17, 2024
3127dee
Rewrite accessibility in es5
ayjayt Jan 17, 2024
2429e55
Merge pull request #1 from geopozo/pikul-music-import-promise
aliwelchoo Jan 17, 2024
00572e8
Fix some undef errors in accessibility
ayjayt Jan 17, 2024
30f4e11
update plot-schema diff
ayjayt Jan 17, 2024
247b301
Merge branch 'master' into pikul-music-import-promise
ayjayt Jan 25, 2024
d08adfb
Add config so dev can place closed captions:
ayjayt Jan 25, 2024
dbce5da
Merge branch 'chart2music' of https://github.com/aliwelchoo/plotly.js…
ayjayt Jan 25, 2024
e1f9563
Add more default assurance in accessibility
ayjayt Jan 25, 2024
3f4ab54
Lint
ayjayt Jan 25, 2024
92d97b7
Skip empty trace data in accessibility.enable:
ayjayt Jan 25, 2024
6b2dcc9
update plot-schema diff
ayjayt Jan 25, 2024
b5bb517
Modify how accessibility treats config vars:
ayjayt Jan 26, 2024
25ca44a
Remove jasmine ftest focus
ayjayt Jan 26, 2024
7328324
Run schema plot diff
ayjayt Jan 26, 2024
00b2750
Test if previous commits deprecate hack-fix
ayjayt Jan 26, 2024
b04bb17
Set c2music default to not make its caption div:
ayjayt Jan 26, 2024
d4bd71b
update plot-scheme diff
ayjayt Jan 26, 2024
af2ff80
Add closed captions to dev dashboard
ayjayt Jan 26, 2024
80b4cf3
Merge pull request #2 from geopozo/pikul-music-import-promise
aliwelchoo Jan 28, 2024
ee99f35
Merge branch 'master' into chart2music
ayjayt Jan 29, 2024
3841640
Merge branch 'master' into chart2music
ayjayt Feb 9, 2024
d84d108
Merge branch 'master' into chart2music
ayjayt Feb 28, 2024
0c43407
Refactor accessibility/c2m:
ayjayt Feb 28, 2024
4c75035
Lint
ayjayt Feb 28, 2024
3c49ed6
Fix import path
ayjayt Feb 28, 2024
f7be666
Merge remote-tracking branch 'origin/build-with-esbuild' into chart2m…
archmoj Feb 28, 2024
4a260af
Merge branch 'master' into chart2music
ayjayt Mar 10, 2024
f67c513
Merge branch 'master' into chart2music
ayjayt Mar 20, 2024
41baab9
Merge branch 'master' into chart2music
ayjayt Mar 27, 2024
26754b7
Merge with master
marthacryan Sep 16, 2024
ed18907
Change name of config to sonification, clean up directory
marthacryan Sep 23, 2024
1e4bcef
Spelling
marthacryan Sep 23, 2024
2c1abf4
fix directory name
marthacryan Sep 23, 2024
614fb8b
Reset package-lock
marthacryan Sep 23, 2024
5f5e599
Update package-lock.json
marthacryan Sep 23, 2024
fe9736e
Reset tests
marthacryan Sep 23, 2024
59ad5c6
Update auto-generated schema
marthacryan Sep 23, 2024
d18c584
Rename more stuff to sonification and clean up contributing
marthacryan Sep 24, 2024
043d408
Update filepath for new location of enable_sonification.js
marthacryan Sep 24, 2024
129eb3b
Code readability improvements
marthacryan Sep 24, 2024
acc8517
Add baseline for new mock
marthacryan Sep 24, 2024
c5ad240
Remove changes in existing mock
marthacryan Sep 24, 2024
0113d90
Update baseline
marthacryan Sep 24, 2024
771029e
Remove function that was introduced through incorrect merge
marthacryan Sep 24, 2024
bfbbbf1
Undo changes to jasmine tests
marthacryan Sep 25, 2024
cadfd7f
Revert "Code readability improvements"
marthacryan Sep 25, 2024
56e582d
Fix syntax
marthacryan Sep 25, 2024
8e55f98
remove comment
marthacryan Sep 25, 2024
86d75d8
Remove todo
marthacryan Sep 25, 2024
15671b0
Schema update
marthacryan Oct 1, 2024
057e067
Merge branch 'master' of github.com:plotly/plotly.js into chart2music
marthacryan Oct 1, 2024
44f7ad3
Remove accessibility wrapper directory
marthacryan Oct 1, 2024
8e3b62b
Fix filepaths
marthacryan Oct 1, 2024
aed1e02
Code cleanup
marthacryan Oct 1, 2024
1777fba
Code cleanup
marthacryan Oct 1, 2024
3a0384f
Code cleanup
marthacryan Oct 1, 2024
dba0b53
Fix trace bug
marthacryan Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change name of config to sonification, clean up directory
  • Loading branch information
marthacryan committed Sep 23, 2024
commit ed189076b68de9d31c32bdd7d0fb6512108ae2bf
4 changes: 0 additions & 4 deletions devtools/test_dashboard/index-mathjax3.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ <h4>no MathJax: Apple: $2, Orange: $3</h4>
<div id="graph"></div>
</div>
<div id="snapshot"></div>
<div style="position:absolute; border-top: .3em solid #eee; bottom: 0px; left: 0; width: 100%">
<div style="margin-top: -1.2em; padding-left: 3px; font-weight: bold; color: #555; width:100%;">Closed Captions</div>
<div id="c2m-plotly-cc" style="width: 100%; height: 40px; padding: 18px 0 0 15px; color: #333">Test</div>
</div>

<script>
window.MathJax = {
Expand Down
4 changes: 0 additions & 4 deletions devtools/test_dashboard/index-mathjax3chtml.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
<div id="graph"></div>
</div>
<div id="snapshot"></div>
<div style="position:absolute; border-top: .3em solid #eee; bottom: 0px; left: 0; width: 100%">
<div style="margin-top: -1.2em; padding-left: 3px; font-weight: bold; color: #555; width:100%;">Closed Captions</div>
<div id="c2m-plotly-cc" style="width: 100%; height: 40px; padding: 18px 0 0 15px; color: #333">Test</div>
</div>

<script>
window.MathJax = window.MathJax || {
Expand Down
4 changes: 0 additions & 4 deletions devtools/test_dashboard/index-strict.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
<div id="graph"></div>
</div>
<div id="snapshot"></div>
<div style="position:absolute; border-top: .3em solid #eee; bottom: 0px; left: 0; width: 100%">
<div style="margin-top: -1.2em; padding-left: 3px; font-weight: bold; color: #555; width:100%;">Closed Captions</div>
<div id="c2m-plotly-cc" style="width: 100%; height: 40px; padding: 18px 0 0 15px; color: #333">Test</div>
</div>

<script src="../../node_modules/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script charset="utf-8" id="source" src="../../build/plotly.js"></script>
Expand Down
5 changes: 1 addition & 4 deletions devtools/test_dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
<div id="graph"></div>
</div>
<div id="snapshot"></div>
<div style="position:absolute; border-top: .3em solid #eee; bottom: 0px; left: 0; width: 100%">
<div style="margin-top: -1.2em; padding-left: 3px; font-weight: bold; color: #555; width:100%;">Closed Captions</div>
<div id="c2m-plotly-cc" style="width: 100%; height: 40px; padding: 18px 0 0 15px; color: #333">Test</div>
</div>

<script src="../../node_modules/mathjax-v2/MathJax.js?config=TeX-AMS-MML_SVG"></script>
<script charset="utf-8" id="source" src="../../build/plotly.js"></script>
<script charset="utf-8" src="../../build/test_dashboard-bundle.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion src/accessibility/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# accesibility

While anticipating more accesibility libraries in the future, as of today this is a trivial wrapper over the `c2m` directory.
While anticipating more accessibility libraries in the future, as of today this is a trivial wrapper over the `c2m` directory.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `plotly.js` wrapper for `c2m`, sonified charts
# `plotly.js` wrapper for `chart2music`, sonified charts

This wrapper attaches a context object to `gd._context._c2m` with the following properties:

Expand All @@ -15,7 +15,7 @@ The first three have most of their values set by the defaults in *src/plot_api/p
**index.js** exposes the following api:

* `initC2M(gd, defaultConfig)` full resets the `c2mChart` object.
* `defaultConfig` is equal to `gd._context.accessibility`, as defined in *src/plot_api/plot_config.js*.
* `defaultConfig` is equal to `gd._context.sonification`, as defined in *src/plot_api/plot_config.js*.


* `initClosedCaptionDiv(gd, config)` finds or creates the closed caption div, depending on `config`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ var Fx = require('../../components/fx');
var Lib = require('../../lib');

var codecs = require('./all_codecs').codecs;
// var codecs = [ require('./xy_scatter_codec') ]
// I intentionally don't do that because
// a) it's not possible in ESM w/ `import {}`
// b) may break weak tree shakers who bail if `require()` not top-level

function initC2M(gd, defaultConfig) {
// TODO: should this be Lib.getGraphDiv()?
Expand Down
16 changes: 5 additions & 11 deletions src/plot_api/accessibility.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
'use strict';

var c2mPlotly = require('../accessibility/c2m');
var c2mPlotly = require('../accessibility/sonification');

function enable(gd) {
function enable_sonification(gd) {
// Collecting defaults
var defaultConfig = gd._context.accessibility;

if(defaultConfig.library === 'chart2music') {
c2mPlotly.initC2M(gd, defaultConfig);
} else {
// User has some bunk configuration values, what do we do here?
return;
}
var defaultConfig = gd._context.sonification;
c2mPlotly.initC2M(gd, defaultConfig);
}
exports.enable = enable;
exports.enable_sonification = enable_sonification;
2 changes: 1 addition & 1 deletion src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ function _doPlot(gd, data, layout, config) {
}
seq.push(saveRangeInitialForInsideTickLabels);

if(gd._context.accessibility.enabled) seq.push(accessibility.enable);
if(gd._context.sonification.enabled) seq.push(accessibility.enable_sonification);

seq.push(Plots.previousPromises);

Expand Down
5 changes: 2 additions & 3 deletions src/plot_api/plot_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,10 @@ var configAttributes = {
].join(' ')
},

accessibility: {
sonification: {
valType: 'any',
dflt: {
library: 'chart2music',
enabled: true,
enabled: false,
options: {},
info: {},
closedCaptions: {generate: false, elId: 'c2m-plotly-cc', elClassname: 'c2m-plotly-closed_captions'}
Expand Down
11 changes: 10 additions & 1 deletion test/image/mocks/line_scatter.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,14 @@
"line": { "width": 10, "color": "red" },
"marker": { "size": 20, "color": "blue" }
}
]
],
"config": {
"sonification": {
"enabled": true,
"closedCaptions": {
"generate": false,
"elId": "c2m-plotly-cc"
}
}
}
}