-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
keystroke and typedText should return boolean #53
Comments
Also... |
I've added a boolean as a return value for For typedText(), the definition of whether something has been 'handled' or not is more difficult, since really any string could be passed. For example, it would be valid to pass '{}' as a string. Or " ". So, what's the definition of "handled"? Is it whether the formula has been modified? Could you give me an example of some value you would want to pass on to typedText() where you would want it to consider having "not handled" the input? |
In playing around with accessibility and the MathField, I tried a version
where I was handling all the events. I thought there might be some that
weren't handled although, as I noted in the issue, it always called render
so maybe it is the case all events are handled. I think that might still be
the case that some things are not handled, such as when someone hits just
shift or control and not another key. In the end, I abandoned this
approach, but it still seemed like there should be return value so I wrote
up the issue.
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Fri, Feb 23, 2018 at 5:35 PM, Arno Gourdol ***@***.***> wrote:
I've added a boolean as a return value for keystroke(). Not sure why it
wasn't there in the first place.
Also added an optional evt argument. Note that this function was intended
to be used in cases where a synthetic event was generated, and therefore no
'real' event object may be available. However, as you pointed out, the
internal implementation actually did not handle correctly the missing
event. So, this is now fixed, but for good measure, you can also pass an
optional event if you have one.
For typedText(), the definition of whether something has been 'handled' or
not is more difficult, since really any string could be passed. For
example, it would be valid to pass '{}' as a string. Or " ". So, what's the
definition of "handled"? Is it whether the formula has been modified? Could
you give me an example of some value you would want to pass on to
typedText() where you would want it to consider having "not handled" the
input?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#53 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABeWbAQM_QXqbiiCmPLAddWIlmfSFOXzks5tX2dlgaJpZM4SKBQn>
.
|
Description
mathlive has two public functions for handling keys:
MathField.prototype.keystroke
MathField.prototype.typedText
The functions sometimes handle the key input, and sometimes they pass on handling it. There is currently no way to tell if they did something or not. If they returned a boolean indicating whether they handled character, than it would be possible to call one, and if it didn't handle the key call the other or otherwise process the input.
Implementation Notes:
Making this work for keystroke appears trivial because the function it calls returns a boolean.
For typedText, I'm not sure if this is easy or not.
render
is always called at the end, so perhaps everything is handled, but I suspect not. Maybe a hook into the selection changing could be used.The text was updated successfully, but these errors were encountered: