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

Not possible to enter combination symbols on input #40

Open
icc opened this issue Jan 21, 2022 · 12 comments
Open

Not possible to enter combination symbols on input #40

icc opened this issue Jan 21, 2022 · 12 comments

Comments

@icc
Copy link
Contributor

icc commented Jan 21, 2022

When trying to solve a puzzle, if a word contains the letter ä it's not possible input this value via keyboard.
On the keyboard you have to first hit ¨ and then a and they are combined into ä. I suspect the input maybe listens for key events and not input events?

@otacke
Copy link
Owner

otacke commented Jan 21, 2022

@icc Yup. If I remember correctly, that was necessary to make it work properly on Android or iOS. But I'll check.

@icc
Copy link
Contributor Author

icc commented Jan 21, 2022

Aha, I see. Maybe I'll try to look into it later then

@otacke
Copy link
Owner

otacke commented Jan 21, 2022

@icc Is it urgent? I'd have a look this weekend. Might spare you to look at the partially ugly code that grew and grew due to constantly changing requests (and no time/budget for refactoring).

@otacke
Copy link
Owner

otacke commented Jan 21, 2022

@icc Hmm, maybe we should both have a look. I don't have a ¨ key to combine with an a (because German has an ä) on the keyboard, but I just tried ´ and e for é and ^ and o for ô and that works nicely both in the grid and the input fields.

@icc
Copy link
Contributor Author

icc commented Jan 21, 2022

@otacke Not that urgent. If you change to Norweigan Bokmål for KB language you can get ¨ on what is the ]} key on ANSI. I think what is special compared to ´ is it actually outputs ¨ and then it goes back to correct it when hitting a next.

@otacke
Copy link
Owner

otacke commented Jan 21, 2022

@icc Okay, this is a weird one. I'm at https://h5p.org/content-types/crossword (Linux, latest Chrome), changed the keyboard to Bokmål, and I can get a Ä with the two-key combination. Both, in the grid and in the input fields. What OS/browser are you on?

I also glanced at the code (for a grid cell). I definitely had to work around some issues on Android and older browsers, but I don't see a comment why I didn't go for the InputEvent in the first place (except, maybe, "Android [...] doesn't check maxlength on input" - but that comment doesn't tell me what I meant with that ... "Bad former Ollie!"). Maybe I should give the InputEvent another try. But you would need to be my tester, because I cannot reproduce this.

@otacke
Copy link
Owner

otacke commented Jan 21, 2022

@icc I have quickly changed the behavior to use the InputEvent for the grid. I'll have to re-test this on all kinds of devices, but could you please check whether this fixes the problem on your end? If yes, then I assume only for the grid but not for the input fields? Aaand if yes, then I'll try to replace the KeyEvent that I used for changing the input field behavior - and I'll re-test everything on all kinds of devices ...

@otacke
Copy link
Owner

otacke commented Jan 21, 2022

@otacke
Copy link
Owner

otacke commented Feb 1, 2022

@icc I think I know what the issue is and why it works for me but not for you. Crossword is assuming that each character represents one unicode code point. The ä could be one single unicode code point (U+00E4 for ä) which is fine for Crossword, but it could also be a be a composite of two unicode code points (U+0061 for a and U+0308 for ◌̈) and this would most likely throw off the symbol detection. Since ä is a common symbol in Germany, the locale settings here might result in U+00E4 being used whereas your locale setting might report it as U+0308U+0061.

Even if the change to InputEvent in my separate branch fixes the detection, I am pretty sure that there are more places in the code that implicitly assume that each character represents one unicode code point. I guess that comparing the given answers with the expected solutions would also fail.

I'd love to fix this, because it would also affect languages that rely on composite characters, but unfortunately, I currently don't have the time to investigate what's necessary to deal with those properly and to check what parts of the code need to be updated (given that the issue is composite characters) :-/

@Hweyping
Copy link

Hi, I have created a crossword game in Chinese Language, and I face the similar problem. However, I am able to key in the answer with my Samsung handphone. But I am not able to key in any Chinese Character with laptop and iPhone. I will paste the link of the game as well as the answers here.

https://story2021.h5p.com/content/1291639853518537889
Answer:
1 琳琅满目
3 长他人志气灭自己威风
7 意兴阑珊
8 发愣

2 警察队长
4 掩人耳目
5 咖喱火气面包
6身不由己
7 兴致勃勃

Sorry I don't really know anything about code, I don't understand why I can key in with my Samsung phone but not my laptop too , but I really like this game, hope the problem can be solved :)

@otacke
Copy link
Owner

otacke commented May 31, 2022

@Hweyping It's working on your Samsung phone but not on other platforms because different devices use different ways of "sending" a symbols that consist of multiple "subsymbols" to the application that's running in the browser.

This content type was contract work that I created as a contractor for a company and they did not require support for non-latin based languages (or languages that require multiple keystrokes for one symbol). Their requirements were met. I can only implement more features if my time allows, and currently it does not.

@Hweyping
Copy link

@otacke Thanks for your promptly reply ,I see, it's ok, hope this problem can be solved one day .

Thanks a lot :)

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

No branches or pull requests

3 participants