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

[Bug] Keyboard issue on Android mobile devices #7

Closed
RealPlurr opened this issue Jun 2, 2024 · 105 comments · Fixed by #10 or #17
Closed

[Bug] Keyboard issue on Android mobile devices #7

RealPlurr opened this issue Jun 2, 2024 · 105 comments · Fixed by #10 or #17
Labels
bug Something isn't working upstream Change intended for future release
Milestone

Comments

@RealPlurr
Copy link

Describe the Bug
Keyboard doesn't work correctly (or at all) on android phone (redmi 8). Wont type in chat or and wont type in username field.

Steps to Reproduce
Start launcher, click keyboard button try to type and see it works broken or dont work at all.

Additional Information
Browser google and chrome. Latest version available from google play market. Phone redmi 8 using google keyboard and android version 10, MIUI 12.5.3 (stable version)

@RealPlurr RealPlurr added the bug Something isn't working label Jun 2, 2024
@colbster937
Copy link
Contributor

idk if it will work i was the one who added the keyboard button and i only have iOS so i only tested it there

@RealPlurr

This comment was marked as outdated.

@colbster937
Copy link
Contributor

moves the game down? if its moving the game out of the way for the keyboard then thats probably built into the os/browser.

@RealPlurr
Copy link
Author

Yeah but it also makes like idk white gap between keyboard and game it can be also bug of this js feature idk but anyways it isnt such critical bug the most critical that it wont type at all

@colbster937
Copy link
Contributor

But the keyboard opens right?

@RealPlurr
Copy link
Author

It opens keyboard but it wont type leme attach photos

@RealPlurr
Copy link
Author

Screenshot_2024-06-02-17-03-24-378_com android chrome
Screenshot_2024-06-02-17-03-15-836_com android chrome

@RealPlurr

This comment was marked as off-topic.

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 2, 2024

I have several ideas I can try, but support is limited since we currently don’t have any android devices to test with.
Several ideas:

@colbster937
Copy link
Contributor

I mean we could test in android studio just running a browser

@RealPlurr
Copy link
Author

Okay, I hope y'all will be able to fix it. By the way you can emulate android using BlueStackX or smth

@RealPlurr
Copy link
Author

I mean we could test in android studio just running a browser

Also good option

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 2, 2024

I just quickly added both ideas, holler if it makes a difference.
Edit: I don’t think this will make a difference. The Eagler application is looking for a key event where key, keyCode and which are defined. It may be that your custom keyboard simply isn’t dispatching the correct events, and I’m not really sure how to work around that. If I could directly inject code into the Eagler client during runtime I could easily fix this, but until then I’m not sure. I’ll keep looking into this, and hopefully someone else with more experience with android can weigh in.

@RealPlurr
Copy link
Author

Leme test it rq

@FlamedDogo99 FlamedDogo99 added the upstream Change intended for future release label Jun 2, 2024
@RealPlurr

This comment was marked as off-topic.

@RealPlurr

This comment was marked as off-topic.

@colbster937

This comment was marked as outdated.

@FlamedDogo99
Copy link
Owner

I need to do some more research on this. I’ll get back to you.

@RealPlurr

This comment was marked as outdated.

@RealPlurr

This comment was marked as outdated.

@colbster937

This comment was marked as outdated.

@RealPlurr

This comment was marked as off-topic.

@colbster937

This comment was marked as off-topic.

@RealPlurr
Copy link
Author

I think now its kinda chrome issue fully..

@colbster937
Copy link
Contributor

let me test it on chrome on ios and see if i get the same issues

@colbster937
Copy link
Contributor

no i dont get the issue but its probably because apple makes google use webkit on ios chrome but on android im guessing it uses chromium?

@RealPlurr
Copy link
Author

Yeah it definitely uses Chromium ig. Anyways it still happens probably even android bug idk. The fact keyboard is hella buggy is fact

@colbster937
Copy link
Contributor

try using another browser that has another engine like firefox and see if it happens there

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 4, 2024

I know for a fact that your browser should support Function.prototype functions, which means something else is going wrong outside the scope of what I understand. I haven’t been able to reproduce this error on any other device, which means that until I have time to install BlueStackX, I can’t trouble shoot what is going wrong in these functions:

const _addEventListener = EventTarget.prototype.addEventListener;
Object.defineProperty(EventTarget.prototype, "addEventListener", {
  value: function (type, fn, ...rest) {       
      _addEventListener.call(this, type, function(...args) {
        if(type === 'keydown' && (!args[0].isValid)) {
            return;
        }
        return fn.apply(this, args);
      }, ...rest);
  }
});
const _preventDefault = Event.prototype.preventDefault;
Object.defineProperty(Event.prototype, "preventDefault", {
    value: function () {
        if(document.activeElement.id != "hiddenInput") {
            _preventDefault.call(this);
        }
    }
});

It will be a bit until I can try out BlueStackX, so unless someone else knows what’s going wrong, this will take a while.

@PlurrYT-Kolama
Copy link

can someone else fix this then?

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 4, 2024

Someone else is welcome to try. If they can figure out why your specific device doesn’t handle EventTarget.prototype.addEventListener the same as most other devices, they’d probably be able to help. However without this function (or something similar) you’ll not be able to type in inputs (which is needed because your device just doesn’t work with keydown events), and even if you could type, I’m pretty sure you’d get repeated key presses randomly.
Again, if we could directly edit the eaglercraft client, this wouldn’t be a problem, but since I have no idea how to inject anything during runtime, I’m left trying to redefine base functions that the client or browser itself calls.

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 6, 2024

Alright, this is my last attempt on this particular solution for the android keyboard problems. It works on Safari, macOS chrome, and even Orion, so if it throws an error on your device, I’m out of ideas.
https://raw.githubusercontent.com/FlamedDogo99/EaglerMobile/keyboard-fix/eaglermobile.user.js

@RealPlurr
Copy link
Author

Testing...

@RealPlurr
Copy link
Author

Screenshot_2024-06-06-07-13-08-515_com android chrome
I think its beacuse android doesn't understand "fn"? All other errots contained fn and here to.

@RealPlurr
Copy link
Author

It throws error in multiplayer tab mostly

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 6, 2024

Wait it does this without you even typing?
Edit: I can recreate the crash on the multiplayer page as well, which is very very weird. This means that something else is going wrong. I’ll look into this more, thanks for testing.
Edit 2: I was working under the assumption that the crash was just occurring whenever you tried to type. Can you type on the profile name page then?
Edit 3: That makes so much more sense! I only ever tested it on the profile name page. I think I know what’s going wrong, and I’ll work on it tomorrow.

@RealPlurr
Copy link
Author

Hi yeah managed to recreate it in other pages too, anyways yeah it crashes without any interaction i guess i explained really bad. My bad, I'll wait for a fix and sorry that I explained without big ammount of details :)

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 6, 2024

I think I fixed it. Currently anything besides a-z, A-Z, 0-9, and the delete key will probably not work, but if there’s no crashes that will be easy to fix.
Edit: All client special characters should be supported now. As long as yours doesn't throw an error, I think this it it!
Edit 2: If so, I still need to add in user-agent detection, but that should be pretty straight forward

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 6, 2024

I think there’s a syntax error in there somewhere, so if it looks broken it’s my fault. I’ll fix it this afternoon.
Edit: It’s (mostly) fixed now. The keyboard workaround is currently set to always be active in version 2.18, but the final iteration will have it automatically switch on as needed. If someone could test it, that would be great.

@FlamedDogo99 FlamedDogo99 linked a pull request Jun 7, 2024 that will close this issue
@RealPlurr
Copy link
Author

Okay testing updated version

@RealPlurr
Copy link
Author

Screenshot_2024-06-07-07-56-11-702_com android chrome
New issue, typing works fine in profils page but when it goes to server (chat) you cant select chat line and / or type there

@RealPlurr
Copy link
Author

But yeah it fixed error and I managed to join server ^^^

@FlamedDogo99
Copy link
Owner

FlamedDogo99 commented Jun 7, 2024

But yeah it fixed error and I managed to join server ^^^

That’s a step in the right direction then, that’s very exciting.

New issue: typing works fine in profile page but when it goes to server (chat) you can’t select chat line or type there

I’m hoping it’s just that I broke something small when I reworked the keyEvent function, because that’s an odd issue. I’ll look into it further tomorrow, thanks for testing.

@FlamedDogo99 FlamedDogo99 changed the title [Bug] Keyboard issue on mobile [Bug] Keyboard issue on Android mobile devices Jun 7, 2024
@FlamedDogo99 FlamedDogo99 reopened this Jun 8, 2024
@FlamedDogo99
Copy link
Owner

Out of curiosity, when you go to chat is there a blinking "_" that displays where you would be typing?

@RealPlurr
Copy link
Author

Hello im back I'll test in minutes

@RealPlurr
Copy link
Author

RealPlurr commented Jun 8, 2024

Wait where is latest code just it shows yesterday at all js codes if you mean at all version no its not blinking _ if you about new version idk where it is located at

Edit: not all versions but old version did typo*

@FlamedDogo99
Copy link
Owner

I'm going to close this issue and open a new one specifically for not being able to type in chat on android, since we have solved the problem with not being able to dispatch valid keyboard events.

@FlamedDogo99 FlamedDogo99 added this to the 3.1.0 milestone Jun 15, 2024
@FlamedDogo99
Copy link
Owner

I just realized that this is not fully fixed with some Android devices, although I think got it working on the input-fix branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream Change intended for future release
Projects
None yet
4 participants