-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved Experimental Math Testbook to DAISY's TIES GitHub Repo
- Loading branch information
Showing
20 changed files
with
1,874 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+113 KB
experimental/build/Experimental-Accessibility-Tests-Mathematics-v1.2.6.epub
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.13 KB
experimental/content/epub30-test-0330/EPUB/Images/epub-image-2pointform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions
54
experimental/content/epub30-test-0330/EPUB/Images/epub-image-2pointform.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
138 changes: 138 additions & 0 deletions
138
experimental/content/epub30-test-0330/EPUB/Misc/a11yMath.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// Test if MathML is supported by Reading System | ||
// This is a hueristic: | ||
// There are probably cases where this should return false because the screen readers we | ||
// know about (NVDA, JAWS, VoiceOver, TalkBack, ChomeVox) all handle MathML. | ||
// So the basic assumption is that MathML is accessible if JS runs. | ||
// Cases where this isn't true: | ||
// Linux (Orca now supports this) | ||
// Edge -- uses UIA, and that doesn't expose MathML | ||
// ?? Non Safari on MacOS | ||
function CanUseMathML() { | ||
var isLinux = function(){ | ||
var matches = window.navigator.userAgent.match(/Linux/); | ||
return (matches!=null && matches.length==1); | ||
} | ||
var isEdge = function(){ | ||
var matches = window.navigator.userAgent.match(/Edge\/\d+/); | ||
return (matches!=null); | ||
}; | ||
return !isEdge(); | ||
} | ||
|
||
/* ScreenReaderSpeak(text, priority) | ||
text: the message to be vocalised | ||
priority (non mandatory): "polite" (by default) or "assertive" */ | ||
|
||
function ScreenReaderSpeak(text, priority) { | ||
var el = document.createElement("div"); | ||
var id = "speak-" + Date.now(); | ||
el.setAttribute("id", id); | ||
el.setAttribute("aria-live", priority || "polite"); | ||
el.classList.add("MathMLNoDisplay"); | ||
document.body.appendChild(el); | ||
|
||
window.setTimeout(function () { | ||
document.getElementById(id).innerHTML = text; | ||
}, 100); | ||
|
||
window.setTimeout(function () { | ||
document.body.removeChild(document.getElementById(id)); | ||
}, 1000); | ||
} | ||
|
||
function CopyToClipboard(buttonElement, containerId) | ||
{ | ||
var range = document.createRange(); | ||
range.selectNode(document.getElementById(containerId)); | ||
var docFragment = range.cloneContents (); | ||
|
||
var tempDiv = document.createElement ("div"); | ||
tempDiv.appendChild (docFragment); | ||
|
||
var selected = | ||
document.getSelection().rangeCount > 0 // Check if there is any content selected previously | ||
? document.getSelection().getRangeAt(0) // Store selection if found | ||
: false; | ||
|
||
var tempTextArea = document.createElement('textarea'); | ||
tempTextArea.value = tempDiv.innerHTML; | ||
//Prevent visual and screen reader access to this temp textarea | ||
tempTextArea.setAttribute('readonly', ''); | ||
tempTextArea.style.position = 'absolute'; | ||
tempTextArea.style.left = '-9999px'; | ||
tempTextArea.setAttribute("aria-hidden", "true"); | ||
|
||
document.body.appendChild(tempTextArea); | ||
tempTextArea.select(); //Select the text inside this hidden textarea | ||
|
||
document.execCommand("copy"); //Copy the selected text to the Clipboard | ||
|
||
var previousText = buttonElement.innerHTML; | ||
var copiedText = 'Math copied'; | ||
ScreenReaderSpeak(copiedText, "assertive"); //Speak 'math copied to clipboard' | ||
buttonElement.innerHTML = copiedText; //Set text of button to what is spoken for consistency | ||
window.setTimeout(function () | ||
{ | ||
buttonElement.innerHTML = previousText; | ||
}, 2000); | ||
|
||
document.body.removeChild(tempTextArea); //Remove temp textarea | ||
|
||
if (selected) { // If a selection existed before copying | ||
document.getSelection().removeAllRanges(); // Unselect everything on the HTML document | ||
document.getSelection().addRange(selected); // Restore the original selection | ||
} | ||
|
||
}; | ||
|
||
// ForFach method for working on a nodelist as opposed to the built-in one for arrays | ||
// IMHO, this makes for cleaner code | ||
function ForEach(nodeList, callback, scope) { | ||
for (var i = 0; i < nodeList.length; i++) { | ||
callback(nodeList[i]); // passes back stuff we need | ||
} | ||
}; | ||
|
||
// Note: in HTHML, tag and attribute names are case-insensitive; in XHTML, they are case-sensitive | ||
// Class names are case-sensitive in HTML, but not CSS. | ||
function MakeMathAccessible() { | ||
if (!CanUseMathML()) | ||
return; | ||
|
||
var setARIAHidden = function(element) { | ||
element.setAttribute("aria-hidden", "true"); | ||
}; | ||
var unsetARIAHidden = function(element) { | ||
element.removeAttribute("aria-hidden"); // use remove rather than unset due to NVDA/IE bug | ||
}; | ||
var changeImage = function(element) { | ||
element.setAttribute("alt", ""); | ||
element.setAttribute("aria-hidden", "true"); | ||
}; | ||
|
||
var unsetHiddenSummary = function(element) { | ||
element.style.display = 'block'; | ||
}; | ||
|
||
var changeMathSpanIfRequired = function(element) { | ||
if (element.getAttribute("role")=="math") { | ||
element.setAttribute("aria-hidden", "true"); | ||
} | ||
if (element.getAttribute("class") && | ||
element.getAttribute("class").indexOf("MathMLNoDisplay") >=0) { | ||
element.parentNode.removeChild(element) | ||
} | ||
}; | ||
|
||
ForEach( document.getElementsByClassName("MathMLNoJavaHidden"), unsetARIAHidden ); | ||
ForEach( document.getElementsByClassName("MathImageNoSR"), changeImage ); | ||
|
||
ForEach( document.getElementsByClassName("HideSummaryOfMath"), unsetHiddenSummary ); | ||
|
||
|
||
// used for HTML math case to remove the text from AT to avoid double speak | ||
ForEach( document.getElementsByTagName("span"), changeMathSpanIfRequired ); | ||
|
||
// make sure MathJax CSS math is hidden, not needed for properly done pages | ||
ForEach( document.getElementsByClassName("MathJax"), setARIAHidden ); | ||
} |
79 changes: 79 additions & 0 deletions
79
experimental/content/epub30-test-0330/EPUB/Styles/a11yMath.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
.MathMLNoDisplay { | ||
clip: rect(1px, 1px, 1px, 1px); | ||
position: absolute !important; | ||
white-space: nowrap; | ||
height: 1px; | ||
width: 1px; | ||
overflow: hidden; | ||
} | ||
|
||
.OffScreen{ | ||
/*same as MathMLNoDisplay but not acted upon by JS for test 021*/ | ||
clip: rect(1px, 1px, 1px, 1px); | ||
position: absolute !important; | ||
white-space: nowrap; | ||
height: 1px; | ||
width: 1px; | ||
overflow: hidden; | ||
} | ||
|
||
.HideSummaryOfMath{ | ||
display:none; | ||
} | ||
|
||
/* turn off MathML display on kindles */ | ||
|
||
body { | ||
margin-top: 2em; | ||
margin-right: 2em; | ||
margin-left: 2em; | ||
margin-bottom: 10em; | ||
} | ||
|
||
table { | ||
border-spacing: 0; | ||
border-collapse: collapse; | ||
} | ||
|
||
td { | ||
padding: 1em; | ||
} | ||
|
||
:target { | ||
border: 1px dotted blue; | ||
} | ||
|
||
|
||
summary { | ||
border: 1px solid silver; | ||
} | ||
|
||
caption, .caption, figcaption { | ||
font-size: 80%; | ||
caption-side: top; | ||
text-align: left; | ||
} | ||
|
||
thead td { | ||
font-weight: bold; | ||
} | ||
|
||
a:focus, a:active, a:hover { | ||
outline-width: 1px; | ||
outline-style: dashed; | ||
outline-color: red; | ||
} | ||
|
||
:target { | ||
border: 2px solid black; | ||
padding: 0.6em; | ||
} | ||
|
||
details[open] { | ||
border: 2px solid black; | ||
} | ||
|
||
.note { | ||
font-style: italic; | ||
font-size: smaller; | ||
} |
84 changes: 84 additions & 0 deletions
84
experimental/content/epub30-test-0330/EPUB/Styles/base.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
@charset "utf-8"; | ||
|
||
body { | ||
font-family: arial, helvetica, sans-serif; | ||
color: black; | ||
background: white; | ||
} | ||
|
||
.test-id, .demo-ctest { | ||
font-size: 80%; | ||
font-style: normal; | ||
color:gray; | ||
margin-right: 1em; | ||
padding: 0.3em; | ||
} | ||
|
||
.ctest, .otest { | ||
margin-bottom: 1em; | ||
padding-left: 1em; | ||
} | ||
|
||
.ctest { | ||
border: 1px solid gray; | ||
margin-bottom: 1em; | ||
padding-left: 1em; | ||
} | ||
|
||
.otest { | ||
border: 1px dotted gray; | ||
margin-bottom: 1em; | ||
padding-left: 1em; | ||
} | ||
|
||
.nature { | ||
display: block; | ||
padding-right: 1em; | ||
padding-left: 0.5em; | ||
font-size: 50%; | ||
} | ||
|
||
.ctest .nature { | ||
color: rgb(255,0,0); | ||
} | ||
|
||
.otest .nature { | ||
color: rgb(0,0,255); | ||
} | ||
|
||
.test-label-info { | ||
display: inline; | ||
font-size: 100% | ||
} | ||
|
||
dl.info dt { | ||
font-weight: bold; | ||
margin-bottom: 1em; | ||
} | ||
|
||
.skippable { | ||
background-color: green; | ||
color: white; | ||
padding: 0.6em; | ||
} | ||
|
||
.escapable1 { | ||
border: 4px solid blue; | ||
padding: 0.6em; | ||
} | ||
|
||
.escapable2 { | ||
border: 8px solid magenta; | ||
padding: 0.6em; | ||
} | ||
|
||
/*for the active text element*/ | ||
.-epub-media-overlay-active { | ||
background-color: pink !important; | ||
color: black !important; | ||
} | ||
/*for the currently-playing document*/ | ||
.-epub-media-overlay-playback-active .mo-playing { | ||
background-color: green !important; | ||
color: white !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Cover</title> | ||
<meta charset="utf-8"/></head> | ||
<body> | ||
<div class="body"> | ||
<img src="../Images/cover.jpg" alt="Cover: Experimental Accessibility Tests for Mathematics, by DAISY Consortium and DIAGRAM Center" /></div> | ||
</body> | ||
</html> |
Oops, something went wrong.