Skip to content
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

text mode is not setting the 'type' field, so speech inside of text doesn't happen #313

Closed
NSoiffer opened this issue Dec 4, 2019 · 2 comments
Assignees
Labels

Comments

@NSoiffer
Copy link
Collaborator

NSoiffer commented Dec 4, 2019

Describe the bug
When you arrow left/right inside of a text run, nothing is spoken. I tracked this down to this.type not being set inside of MathAtom.MathAtom.prototype.toMathML.

To Reproduce

  1. Either make sure that the mathfield you are working on has smartMode:true or see alternative entry below.
  2. Type x=foo ("foo" will be text)
  3. With a screen reader running, hit the right arrow key. No speech happens. If you arrow until you are in front of the =, you will hear "equals".

If smartMode is not on, then in step 2 type x=\text{foo} followed by 'enter'.

Source Code
Looking in the debugger in outputMathML.js, at the switch statement in MathAtom.MathAtom.prototype.toMathML, this.type is an empty string. There is no default case, so the result is empty since the switch expects some value.

I think there are two possible solutions:

  1. this.type should be set (maybe to "text"?) somewhere. It seems wrong that the type is not set. Once set, add the appropriate case statement in MathAtom.MathAtom.prototype.toMathML
  2. add a case '': to the switch statement and check for this.mode==='text'.

It is probably a good idea to add a default case to the switch statement that creates a console message if it is hit.

Note: put a breakpoint in _onAnnounce in mathfield.js and when it is hit, then put one on the switch statement in MathAtom.MathAtom.prototype.toMathML. The later is hit too often to be useful otherwise.

@NSoiffer
Copy link
Collaborator Author

latexToAST is also failing:

{"fn":"text","arg":[{"fn":"equal","arg":[{"sym":"x"},{"text":"?","error":"Unexpected token ''","latex":"f"}]},"oo"]}

That's a sign that the right solution is probably '1' above: set this.type somewhere.

@NSoiffer
Copy link
Collaborator Author

Arno and I discussed this on a call and he felt that when mode==='text', then there is no type. So the proper thing to do is to check for mode==='text' and do the right thing. If it is not text, then do the switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants