feat: Support \vcenter and \hbox (#2452)

* Support \vcenter, \raise, \lower, and \hbox

* Update screenshots

* Edit docs for strict and hbox to

* Fix typo for \hbox to

* Update Safari screenshot

* Augment docs for \vcentcolon

* Edit vcenter MathML comment.

* Remove pointless class from vcenter MathML

* Withdraw \raise and \lower

* Updatae Chrome and Firefox screenshots

* Update Safari screenshot

* Delete allowedInArgument setting

Co-authored-by: ylemkimon <y@ylem.kim>

* Update Chrome and Firefox screenshots

* Update Chrome and Firefox screenshots take 2

* Update screenshot

Co-authored-by: ylemkimon <y@ylem.kim>
This commit is contained in:
Ron Kok
2020-11-14 01:45:14 -08:00
committed by GitHub
parent ebd86b90c4
commit 60aecbdfe2
16 changed files with 169 additions and 10 deletions

View File

@@ -327,6 +327,11 @@ const handleObject = (
break;
}
case "hbox": {
buildA11yStrings(tree.body, a11yStrings, atomType);
break;
}
case "kern": {
// No op: we don't attempt to present kerning information
// to the screen reader.
@@ -546,6 +551,11 @@ const handleObject = (
`KaTeX-a11y: enclose node with ${tree.label} not supported yet`);
}
case "vcenter": {
buildA11yStrings(tree.body, a11yStrings, atomType);
break;
}
case "vphantom": {
throw new Error("KaTeX-a11y: vphantom not implemented yet");
}

View File

@@ -272,6 +272,13 @@ describe("renderA11yString", () => {
});
});
describe("hbox", () => {
test("\\hbox", () => {
const result = renderA11yString("x+\\hbox{y}");
expect(result).toMatchInlineSnapshot(`"x, plus, y"`);
});
});
describe("inner", () => {
test("\\ldots", () => {
const result = renderA11yString("\\ldots");
@@ -524,6 +531,13 @@ describe("renderA11yString", () => {
});
});
describe("vcenter", () => {
test("\\vcenter", () => {
const result = renderA11yString("x+\\vcenter{y}");
expect(result).toMatchInlineSnapshot(`"x, plus, y"`);
});
});
describe("verb", () => {
test("\\verb", () => {
const result = renderA11yString("\\verb|hello|");