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

Problems with autocomplete function [Cannot read properties of undefined (reading 'length')] #161

Closed
rodrigogpontes opened this issue Jun 13, 2024 · 5 comments · Fixed by #162
Assignees
Labels

Comments

@rodrigogpontes
Copy link

Hi.
Recently we updated the version of WebGLInput plugin used in our projects, from 1.3.1 to 1.4.0, to correct the backwards typing problem with fullscreen mode, but now we are noticing a new problem with some TMPro InputFields who have the 'Content Type' = 'Email Address'.

When are used the autocomplete function to write an email address to a login field, this error happens:

Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at lengthBytesUTF8 (f4a96543-38bc-446a-9579-7fdc60046107:2:13555)
at func (f4a96543-38bc-446a-9579-7fdc60046107:2:76224)
at HTMLInputElement. (f4a96543-38bc-446a-9579-7fdc60046107:2:76701)

I'm sending a picture of the error to a better anaysis. The game was tested using the 125.0.2535.92 version of Microsoft Edge browser in a Windows 11 environment, and the game was developed using Unity 2021.3.36f1.

Thanks in advance, and thanks again for making this so useful project for all of us.

Best regards,
Rodrigo

error

@kou-yeung kou-yeung added the verification scheduled 検証予定 label Jun 14, 2024
@kou-yeung kou-yeung self-assigned this Jun 14, 2024
@kou-yeung
Copy link
Owner

i tried to build a sample to the this issue.
i was use Microsoft Edge( 126.0.2592.56 ). but my sample not showed the autocomplete to me.
I want to know more details.

  1. autocomplete function was worked at WebGLInput 1.3.1 ?
  2. if no need the autocomplete . you can try below change to WebGLInput.jslib
WebGLInput.jslib Line.75~
// before
if(isPassword){
    input.type = 'password';
}

// after
if(isPassword){
    input.type = 'password';
} else {
    input.autocomplete = 'off'; // set the autocomplete off
}

WebGLInput has not passed "Content Type" to html element.
so, I don't know why the html element show the autocomplete to you ><

@rodrigogpontes
Copy link
Author

Hi. Thanks for the reply!

Answering the questions:

  1. autocomplete function was worked at WebGLInput 1.3.1 ?

Yes, with the older version the autocomplete browser's function work flawlessly, but we changed to the plugin's new version because the old one had problems with the fullscreen mode (backward typing, for example).

  1. if no need the autocomplete . you can try below change to WebGLInput.jslib

We did the changes but, unfortunately, the problem persists. Edge continue showing the "Saved personal info" box when the user click on the e-mail field (see the next image). I'm not sure if this box is presented to all users or only to users who sign-in the Edge account like me.

pic01

Reading a bit more about this error in the console, I suspect this is related with the new function _WebGLInputOnKeyboardEvent. In the next picture I'm sharing the sequence of calls, indicated by the browser's console, who give us error when we click on a e-mail address from the Edge's "Saved personal info" box.

pic02

Best regards,
Rodrigo

@kou-yeung
Copy link
Owner

kou-yeung commented Jun 29, 2024

thanks~
i got how to fix this issue.

autocomplete was post event for keydown.
but the event type is not "KeyboardEvent". ( autocomplete is post "Event"

so. i can check the instance is KeyboardEvent or not
like:

if (e instanceof KeyboardEvent){ }

kou-yeung added a commit that referenced this issue Jun 29, 2024
fix #161 : autocomplete was post event to keydown.
@kou-yeung kou-yeung reopened this Jun 29, 2024
@kou-yeung
Copy link
Owner

release a new version to fix this issue~
https://github.com/kou-yeung/WebGLInput/releases/tag/1.4.1

@rodrigogpontes
Copy link
Author

Tested and working flawlessly.
@kou-yeung thank you!

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

Successfully merging a pull request may close this issue.

2 participants