maidr 2.13.0 → 2.14.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/README.md CHANGED
@@ -397,22 +397,19 @@ To learn more about the theoretical background and user study results, we recomm
397
397
  }
398
398
  ```
399
399
 
400
- 1. [Born Accessible Data Science and Visualization Courses: Challenges of Developing Curriculum to be Taught by Blind Instructors to Blind Students](https://arxiv.org/abs/2403.02568v1):
400
+ 2. [Designing Born-Accessible Courses in Data Science and Visualization: Challenges and Opportunities of a Remote Curriculum Taught by Blind Instructors to Blind Students](https://diglib.eg.org:8443/server/api/core/bitstreams/6d392735-a045-46bb-867c-90b0a538b1b7/content):
401
401
 
402
402
  ```tex
403
- @misc{seoBornAccessibleData2024,
404
- title = {Born {{Accessible Data Science}} and {{Visualization Courses}}: {{Challenges}} of {{Developing Curriculum}} to Be {{Taught}} by {{Blind Instructors}} to {{Blind Students}}},
405
- shorttitle = {Born {{Accessible Data Science}} and {{Visualization Courses}}},
406
- author = {Seo, JooYoung and O'Modhrain, Sile and Xia, Yilin and Kamath, Sanchita and Lee, Bongshin and Coughlan, James M.},
407
- year = {2024},
408
- month = mar,
409
- number = {arXiv:2403.02568},
410
- eprint = {2403.02568},
411
- primaryclass = {cs},
412
- publisher = {{arXiv}},
413
- urldate = {2024-03-08},
414
- archiveprefix = {arxiv},
415
- keywords = {Computer Science - Human-Computer Interaction}
403
+ @inproceedings{10.2312:eved.20241053,
404
+ booktitle = {EuroVis 2024 - Education Papers},
405
+ editor = {Firat, Elif E. and Laramee, Robert S. and Andersen, Nicklas Sindelv},
406
+ title = {{Designing Born-Accessible Courses in Data Science and Visualization: Challenges and Opportunities of a Remote Curriculum Taught by Blind Instructors
407
+ to Blind Students}},
408
+ author = {JooYoung Seo and Sile O'Modhrain and Yilin Xia and Sanchita Kamath and Bongshin Lee and James M. Coughlan},
409
+ year = {2024},
410
+ publisher = {The Eurographics Association},
411
+ isbn = {978-3-03868-257-8},
412
+ doi = {10.2312/eved.20241053}
416
413
  }
417
414
  ```
418
415
 
package/dist/maidr.js CHANGED
@@ -4433,6 +4433,11 @@ class Display {
4433
4433
  globalMax = constants.maxX;
4434
4434
  }
4435
4435
 
4436
+ // exception: return if we're out of bounds
4437
+ if (plotPos < 0 || plotPos >= plot.plotData.length) {
4438
+ return;
4439
+ }
4440
+
4436
4441
  // We convert main plot data to array of values and types, including min and max, and seperating outliers and removing nulls
4437
4442
  let valData = [];
4438
4443
  valData.push({ type: 'global_min', value: globalMin });
@@ -4698,8 +4703,6 @@ class Display {
4698
4703
  }
4699
4704
  }
4700
4705
 
4701
- constants.brailleInput.value = brailleArray.join('');
4702
-
4703
4706
  constants.brailleInput.value = brailleArray.join('');
4704
4707
  if (constants.debugLevel > 5) {
4705
4708
  console.log('braille:', constants.brailleInput.value);
@@ -8210,35 +8213,30 @@ class Control {
8210
8213
  constants.lastx = 0;
8211
8214
  let lastPlayed = '';
8212
8215
 
8213
- // testing for braille cursor routing
8214
- /*
8216
+ // braille cursor routing
8215
8217
  document.addEventListener('selectionchange', function (e) {
8216
- // notes:
8217
- // this basically works
8218
- // constants.braillInput.selectionStart is the key, and is the position,
8219
- // but it starts at 1, so we need to subtract 1 to get the actual position
8220
- // hard part is that we need to wire this through the whole script
8221
- // event is selectionchange, so we'll either need to refactor and do separate events + functions for this,
8222
- // or pull UpdateAll() etc into their own area so it can be triggered from anywhere
8223
- // ... ideally let's do that. Better yet, have a global UpdateAll, not per chart
8224
-
8225
- const selection = document.getSelection();
8226
- console.log('Testing cursor routing', new Date().toLocaleTimeString());
8227
- console.log('selection: ', selection);
8228
- let pos = constants.brailleInput.selectionStart;
8229
- console.log('Position: ', pos);
8230
- position.x = pos - 1; // selection starts at 1, so we subtract 1 to get the actual position
8231
- let testEnd = lockPosition();
8232
-
8233
- // update display / text / audio
8234
- if (testEnd) {
8235
- UpdateAll();
8236
- }
8237
- if (testEnd) {
8238
- audio.playEnd();
8218
+ if (constants.brailleMode == 'on') {
8219
+ let pos = constants.brailleInput.selectionStart;
8220
+ // we're using braille cursor, update the selection from what was clicked
8221
+ pos = constants.brailleInput.selectionStart;
8222
+ if (pos < 0) {
8223
+ pos = 0;
8224
+ }
8225
+ position.x = pos;
8226
+ lockPosition();
8227
+ let testEnd = true;
8228
+
8229
+ // update display / text / audio
8230
+ if (testEnd) {
8231
+ UpdateAll();
8232
+ }
8233
+ if (testEnd) {
8234
+ audio.playEnd();
8235
+ }
8236
+ } else {
8237
+ // we're using normal cursor, let the default handle it
8239
8238
  }
8240
8239
  });
8241
- */
8242
8240
 
8243
8241
  // control eventlisteners
8244
8242
  constants.events.push([
@@ -8417,17 +8415,19 @@ class Control {
8417
8415
  function lockPosition() {
8418
8416
  // lock to min / max postions
8419
8417
  let didLockHappen = false;
8420
- // if (!constants.hasRect) {
8421
- // return didLockHappen;
8422
- // }
8423
8418
 
8424
8419
  if (position.x < 0) {
8425
8420
  position.x = 0;
8426
8421
  didLockHappen = true;
8422
+ if (constants.brailleMode != 'off') {
8423
+ // change selection to match postion as well
8424
+ constants.brailleInput.selectionEnd = 0;
8425
+ }
8427
8426
  }
8428
8427
  if (position.x > plot.plotData.length - 1) {
8429
8428
  position.x = plot.plotData.length - 1;
8430
8429
  didLockHappen = true;
8430
+ constants.brailleInput.selectionEnd = plot.plotData.length - 1;
8431
8431
  }
8432
8432
 
8433
8433
  return didLockHappen;
@@ -8514,6 +8514,59 @@ class Control {
8514
8514
  }
8515
8515
  let lastPlayed = '';
8516
8516
 
8517
+ // braille cursor routing
8518
+ // bug: still not working. Not really sure what's going on but the tethering is now totally broken
8519
+ // like, it doesn't even seem to be on the right plot
8520
+ document.addEventListener('selectionchange', function (e) {
8521
+ e.preventDefault();
8522
+ if (
8523
+ constants.brailleMode == 'on' &&
8524
+ constants.brailleInput.selectionStart
8525
+ ) {
8526
+ let cursorPos = constants.brailleInput.selectionStart;
8527
+ // we're using braille cursor, update the selection from what was clicked
8528
+ cursorPos = constants.brailleInput.selectionStart;
8529
+ if (cursorPos < 0) {
8530
+ pos = 0;
8531
+ }
8532
+ // convert braille position to start of whatever section we're in
8533
+ let walk = 0;
8534
+ let posType = '';
8535
+ if (constants.brailleData) {
8536
+ for (let i = 0; i < constants.brailleData.length; i++) {
8537
+ walk += constants.brailleData[i].numChars;
8538
+ if (walk > cursorPos) {
8539
+ if (constants.brailleData[i].type == 'blank') {
8540
+ posType = constants.brailleData[i + 1].type;
8541
+ } else {
8542
+ posType = constants.brailleData[i].type;
8543
+ }
8544
+ break;
8545
+ }
8546
+ }
8547
+ }
8548
+ let pos = plot.sections.indexOf(posType);
8549
+
8550
+ if (posType.length > 0) {
8551
+ if (constants.plotOrientation == 'vert') {
8552
+ position.y = pos;
8553
+ } else {
8554
+ position.x = pos;
8555
+ }
8556
+ lockPosition();
8557
+ let testEnd = true;
8558
+
8559
+ // update display / text / audio
8560
+ if (testEnd) {
8561
+ UpdateAll();
8562
+ }
8563
+ if (testEnd) {
8564
+ audio.playEnd();
8565
+ }
8566
+ }
8567
+ }
8568
+ });
8569
+
8517
8570
  // control eventlisteners
8518
8571
  constants.events.push([
8519
8572
  constants.chart,
@@ -8526,12 +8579,14 @@ class Control {
8526
8579
  if (e.key == 'ArrowRight') {
8527
8580
  if (constants.isMac ? e.metaKey : e.ctrlKey) {
8528
8581
  if (e.shiftKey) {
8582
+ // autoplay
8529
8583
  if (constants.plotOrientation == 'vert') {
8530
8584
  Autoplay('right', position.x, plot.plotData.length - 1);
8531
8585
  } else {
8532
8586
  Autoplay('right', position.x, plot.sections.length - 1);
8533
8587
  }
8534
8588
  } else {
8589
+ // move to end
8535
8590
  isAtEnd = lockPosition();
8536
8591
  if (constants.plotOrientation == 'vert') {
8537
8592
  position.x = plot.plotData.length - 1;
@@ -8550,6 +8605,7 @@ class Control {
8550
8605
  lastY = position.y;
8551
8606
  Autoplay('reverse-right', plot.plotData.length - 1, position.x);
8552
8607
  } else {
8608
+ // normal movement
8553
8609
  if (position.x == -1 && position.y == plot.sections.length) {
8554
8610
  position.y -= 1;
8555
8611
  }
@@ -9122,6 +9178,45 @@ class Control {
9122
9178
  let lastPlayed = '';
9123
9179
  constants.lastx = 0;
9124
9180
 
9181
+ document.addEventListener('selectionchange', function (e) {
9182
+ if (constants.brailleMode == 'on') {
9183
+ let pos = constants.brailleInput.selectionStart;
9184
+
9185
+ // exception: don't let users click the seperator char
9186
+ let seperatorPositions = constants.brailleInput.value
9187
+ .split('')
9188
+ .reduce((positions, char, index) => {
9189
+ if (char === '⠳') positions.push(index);
9190
+ return positions;
9191
+ }, []);
9192
+ if (seperatorPositions.includes(pos)) {
9193
+ return;
9194
+ }
9195
+
9196
+ // we're using braille cursor, update the selection from what was clicked
9197
+ pos = constants.brailleInput.selectionStart;
9198
+ if (pos < 0) {
9199
+ pos = 0;
9200
+ }
9201
+
9202
+ // actual position is based on num_cols and num_rows and the spacer
9203
+ position.y = Math.floor(pos / (plot.num_cols + 1));
9204
+ position.x = pos % (plot.num_cols + 1);
9205
+ lockPosition();
9206
+ let testEnd = true;
9207
+
9208
+ // update display / text / audio
9209
+ if (testEnd) {
9210
+ UpdateAll();
9211
+ }
9212
+ if (testEnd) {
9213
+ audio.playEnd();
9214
+ }
9215
+ } else {
9216
+ // we're using normal cursor, let the default handle it
9217
+ }
9218
+ });
9219
+
9125
9220
  // control eventlisteners
9126
9221
  constants.events.push([
9127
9222
  constants.chart,
@@ -9228,6 +9323,8 @@ class Control {
9228
9323
  constants.navigation = 0;
9229
9324
  }
9230
9325
 
9326
+ console.log('position: ' + position.x + ', ' + position.y);
9327
+
9231
9328
  // update text, display, and audio
9232
9329
  if (updateInfoThisRound && !isAtEnd) {
9233
9330
  UpdateAll();
@@ -9747,6 +9844,32 @@ class Control {
9747
9844
  }
9748
9845
  }
9749
9846
 
9847
+ // todo / bug: does'nt work at all on just line (in gallery)
9848
+ // it sorta works in scatter (in gallery), visual highlight changes, but sonify and text don't update
9849
+ document.addEventListener('selectionchange', function (e) {
9850
+ if (constants.brailleMode == 'on') {
9851
+ let pos = constants.brailleInput.selectionStart;
9852
+ // we're using braille cursor, update the selection from what was clicked
9853
+ pos = constants.brailleInput.selectionStart;
9854
+ if (pos < 0) {
9855
+ pos = 0;
9856
+ }
9857
+ positionL1.x = pos;
9858
+ lockPosition();
9859
+ let testEnd = true;
9860
+
9861
+ // update display / text / audio
9862
+ if (testEnd) {
9863
+ UpdateAllBraille();
9864
+ }
9865
+ if (testEnd) {
9866
+ audio.playEnd();
9867
+ }
9868
+ } else {
9869
+ // we're using normal cursor, let the default handle it
9870
+ }
9871
+ });
9872
+
9750
9873
  constants.events.push([
9751
9874
  constants.brailleInput,
9752
9875
  'keydown',
@@ -10048,6 +10171,30 @@ class Control {
10048
10171
  let lastPlayed = '';
10049
10172
  constants.lastx = 0;
10050
10173
 
10174
+ document.addEventListener('selectionchange', function (e) {
10175
+ if (constants.brailleMode == 'on') {
10176
+ let pos = constants.brailleInput.selectionStart;
10177
+ // we're using braille cursor, update the selection from what was clicked
10178
+ pos = constants.brailleInput.selectionStart;
10179
+ if (pos < 0) {
10180
+ pos = 0;
10181
+ }
10182
+ position.x = pos;
10183
+ lockPosition();
10184
+ let testEnd = true;
10185
+
10186
+ // update display / text / audio
10187
+ if (testEnd) {
10188
+ UpdateAll();
10189
+ }
10190
+ if (testEnd) {
10191
+ audio.playEnd();
10192
+ }
10193
+ } else {
10194
+ // we're using normal cursor, let the default handle it
10195
+ }
10196
+ });
10197
+
10051
10198
  // control eventlisteners
10052
10199
  constants.events.push([
10053
10200
  [constants.chart, constants.brailleInput],
@@ -10294,6 +10441,32 @@ class Control {
10294
10441
  let lastPlayed = '';
10295
10442
  constants.lastx = 0;
10296
10443
 
10444
+ // todo bug, forgot about all mode
10445
+ // bug: you can click 1 past end (for all chart types). Make sure we're lockign and then resetting the selectionStart
10446
+ document.addEventListener('selectionchange', function (e) {
10447
+ if (constants.brailleMode == 'on') {
10448
+ let pos = constants.brailleInput.selectionStart;
10449
+ // we're using braille cursor, update the selection from what was clicked
10450
+ pos = constants.brailleInput.selectionStart;
10451
+ if (pos < 0) {
10452
+ pos = 0;
10453
+ }
10454
+ position.x = pos;
10455
+ lockPosition();
10456
+ let testEnd = true;
10457
+
10458
+ // update display / text / audio
10459
+ if (testEnd) {
10460
+ UpdateAll();
10461
+ }
10462
+ if (testEnd) {
10463
+ audio.playEnd();
10464
+ }
10465
+ } else {
10466
+ // we're using normal cursor, let the default handle it
10467
+ }
10468
+ });
10469
+
10297
10470
  // control eventlisteners
10298
10471
  constants.events.push([
10299
10472
  [constants.chart, constants.brailleInput],
@@ -10651,6 +10824,29 @@ class Control {
10651
10824
  let lastPlayed = '';
10652
10825
  constants.lastx = 0;
10653
10826
 
10827
+ // braille cursor routing
10828
+ document.addEventListener('selectionchange', function (e) {
10829
+ if (constants.brailleMode == 'on') {
10830
+ let pos = constants.brailleInput.selectionStart;
10831
+ // we're using braille cursor, update the selection from what was clicked
10832
+ pos = constants.brailleInput.selectionStart;
10833
+ if (pos < 0) {
10834
+ pos = 0;
10835
+ }
10836
+ position.x = pos;
10837
+ lockPosition();
10838
+ let testEnd = true;
10839
+
10840
+ // update display / text / audio
10841
+ if (testEnd) {
10842
+ UpdateAll();
10843
+ }
10844
+ if (testEnd) {
10845
+ audio.playEnd();
10846
+ }
10847
+ }
10848
+ });
10849
+
10654
10850
  // control eventlisteners
10655
10851
  constants.events.push([
10656
10852
  constants.chart,
@@ -11540,6 +11736,7 @@ function CreateChartComponents() {
11540
11736
  constants.brailleDisplayLength +
11541
11737
  '" ' +
11542
11738
  'aria-brailleroledescription="" ' + // this kills the 2 char 'edit' that screen readers add
11739
+ 'autocomplete="off" ' +
11543
11740
  '/>\n</div>\n'
11544
11741
  );
11545
11742