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

Can't input russian 'б' char when starting a chat #4523

Closed
w1r0x opened this issue Jul 6, 2017 · 14 comments
Closed

Can't input russian 'б' char when starting a chat #4523

w1r0x opened this issue Jul 6, 2017 · 14 comments
Labels
P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@w1r0x
Copy link

w1r0x commented Jul 6, 2017

Description

Incorrect filter implementation on Start Chat input.

Steps to reproduce

  • Press "Start Chat" button
    There is a input for "Who would you like to communicate with?".
  • Input russian char 'б' or 'Б'
    it says "You have entered an invalid contact. Try using their Matrix ID or email address." and no char inputs there.

So I can't search people who name starts with 'Б'.

Web App:

  • Browser: Chromium 59.0.3071.115 amd64
  • OS: Arch Linux
  • URL: v0.11.4
@w1r0x
Copy link
Author

w1r0x commented Jul 6, 2017

It seems, problem appears because russian 'б' shared with english comma ',' on the keyboard. But in different layouts.

@w1r0x
Copy link
Author

w1r0x commented Jul 6, 2017

Keyboard like this one image

@lukebarnard1
Copy link
Contributor

lukebarnard1 commented Jul 6, 2017

@w1r0x I'm not convinced the problem is with this particular character, I'm able to search for a variety of different queries, including your "Б" with no problems.

In fact, when you type any single character and just hit Return , "You have entered an invalid contact" which could mean that you haven't added anyone to be invited. This indicates that the UX for inviting users is a bit subtle and could be better.

(It's possible to invite someone by matrix ID by typing it in exactly and then selecting the first dropdown option.)

@w1r0x
Copy link
Author

w1r0x commented Jul 6, 2017

I also can search if i copy and paste 'Б'. But when I'm trying to type it by keyboard I have an error.
I have this message without hitting Return button

@lukebarnard1
Copy link
Contributor

lukebarnard1 commented Jul 6, 2017

That's very odd. AH. It might actually 100% be to do with the fact the character shares a key code with the comma.

And this is why:

        } else if (e.keyCode === 188 || e.keyCode === 9) { // comma or tab
            e.stopPropagation();
            e.preventDefault();
            this._addInputToList();
        }

@w1r0x out of interest, how do you enter a comma with that keyboard?

@w1r0x
Copy link
Author

w1r0x commented Jul 6, 2017

Yeah it is what I'm talking about.
Maybe in some other non-English languages there will be same problem with comma key.

To enter text we switch layouts. In english layout you type english letters, then press smth like Alt+Shift - switch to russian and type russian text.

@uhoreg
Copy link
Member

uhoreg commented Jul 7, 2017

If you switch it to listen to the keyPress event instead of keyDown, then e.charCode || e.keyCode should give you the character value of the text entered, rather than the code for the key that was pressed. So it should be able to distinguish between comma and б even though they're on the same key (though I haven't tested it). But this seems to only on the keyPress event, and not on keyDown/keyUp, because browsers just want to make things hard for us.

The resources that I use to help navigate through the craziness of keyboard handling in JS are https://www.quirksmode.org/js/keys.html and http://www.unixpapa.com/js/key.html (though they're both a bit dated).

@lampholder lampholder added T-Defect S-Minor Impairs non-critical functionality or suitable workarounds exist P1 labels Jul 11, 2017
@AlexDaniel
Copy link

I'm actually experiencing the same issue but with other (custom) layouts. Indeed, special keys (like arrows, delete, etc) that have different meaning on a different layout don't work as they should. So a “Delete” key that should type something else on a different layout works like Delete even though it shouldn't.

What can I do to help with this issue? Do you need exact steps to reproduce?

@AlexDaniel
Copy link

AlexDaniel commented Sep 13, 2017

@lukebarnard1 where did you take that code? I can't find it anymore. Any ideas on what would be the relevant part of the code today?

@AlexDaniel
Copy link

Nevermind, turns out it is a bug in electron. There's no ticket yet though.

@AlexDaniel
Copy link

Actually, it's a bug in chromium.

There's no ticket for my issue yet, but here are some that may be related:

@lukebarnard1
Copy link
Contributor

@AlexDaniel that seems to be a separate issue. @uhoreg has outlined the fix for this.

@lampholder lampholder added S-Major Severely degrades major functionality or product features, with no satisfactory workaround and removed S-Minor Impairs non-critical functionality or suitable workarounds exist labels Oct 23, 2018
@slipeer
Copy link

slipeer commented Jan 16, 2019

If there is a need to filter comma, it is probably better to process the whole line before sending it to the server?

@t3chguy
Copy link
Member

t3chguy commented Apr 10, 2020

This should be fixed as nowadays we no longer use event.keyCode and instead use event.key

@t3chguy t3chguy closed this as completed Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

No branches or pull requests

7 participants