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] Inconsistent Behavior for World Upload #11

Closed
FlamedDogo99 opened this issue Jun 7, 2024 · 5 comments · Fixed by #12
Closed

[Bug] Inconsistent Behavior for World Upload #11

FlamedDogo99 opened this issue Jun 7, 2024 · 5 comments · Fixed by #12
Labels
bug Something isn't working upstream Change intended for future release

Comments

@FlamedDogo99
Copy link
Owner

Describe the Bug
Uploading a vanilla Minecraft world either leads to a crash, or the file uploader won’t dismiss itself
Steps to Reproduce

  1. Start EaglerCraft client with EaglerMobile userscript
  2. Tap the screen to start the client, and wait for it to load
  3. Navigate to the main menu by hitting done when presented with the edit profile menu
  4. Select single player, create new world, import world, and then upload the world file attached below
  5. Observe a crash, or the file uploader not disappearing

Additional Information
My user agent:

Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1

Eagler Mobile version: 2.4

Screenshot of the file uplaoder not being dismissed after selecting a file:
IMG_0602

The vanilla Minecraft world used in the screenshot:
20 MORE Doors in 100 Seconds! - Copy.zip

@FlamedDogo99 FlamedDogo99 added the bug Something isn't working label Jun 7, 2024
@RealPlurr
Copy link

Btw it happens only in IOS if someone interested ^^^

@colbster937
Copy link
Contributor

i thought you used android? but yeah this is a really annoying bug

@FlamedDogo99
Copy link
Owner Author

FlamedDogo99 commented Jun 7, 2024

If anyone can recreate this issue on other devices and browsers, please leave a comment with the relevant information. (I will be testing it across Safari, Chrome and Firefox on MacOS later tonight.)
Currently I just don’t have enough information to troubleshoot this one, especially the crashes.

The current suspects are:

  1. this weirdness
newElement.addEventListener('change', function(e) {
    this.hidden = true;
})

I don’t have any justification for this one, but I’m going to try using a document.querySelector for the element instead
2. Reusing elements weirdness

if(!newElement) {
    this.body.appendChild(element);
    newElement = document.querySelector('input');
    newElement.addEventListener('change', function(e) {
        this.hidden = true;
    })
}
newElement.value = null;

I’m curious if the event listener behaves differently when we manually set its values. I’ll try deleting the element when the event listener is called, and recreating it when the createElement function is called.

Ideally I’d like to figure out why different browser behave differently when reacting to user inputs. The main problem seems to be built-in safety precautions not recognizing the users initial click as a valid trigger for clicking the input. (On chromium browsers this isn’t even an issue). When the client wants to trigger the file selection, it uses Document.prototype.createElement, to create an input, and dispatches a click event on it. The interesting part about this is that it never adds the element to the DOM. Because the client uses an event listener waiting for the input to load the file, the current fix (that I think still works on image uploads for the player’s skin) is to just hijack the createElement function to directly add the element to the DOM. The click event still doesn’t trigger it, but the user can do it manually. It’s the not the prettiest solution, but it works (at least for the image inputs). Hopefully there is a better, less broken way to go about this.

@FlamedDogo99
Copy link
Owner Author

I just realized that the createElement function is indiscriminately grabbing any input element, which is a really dumb problem. This should be a fairly easy fix. I’ll correct it tomorrow.

@FlamedDogo99 FlamedDogo99 added the upstream Change intended for future release label Jun 8, 2024
@PlurrYT-Kolama
Copy link

i thought you used android? but yeah this is a really annoying bug

i mean yes but i mean it doesnt happens on android

@FlamedDogo99 FlamedDogo99 linked a pull request Jun 8, 2024 that will close this issue
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
Development

Successfully merging a pull request may close this issue.

4 participants