Skip to content

Fixed upload dialog being showed after pressing "x" button#2577

Merged
abidlabs merged 9 commits into
gradio-app:mainfrom
mezotaken:main
Nov 2, 2022
Merged

Fixed upload dialog being showed after pressing "x" button#2577
abidlabs merged 9 commits into
gradio-app:mainfrom
mezotaken:main

Conversation

@mezotaken
Copy link
Copy Markdown
Contributor

@mezotaken mezotaken commented Oct 31, 2022

Description

The issue caused by commit 996cd8b as it seems. Variable disable_click being set to false every time when "x" button is used because at the moment it happens there exists no image.
click variable serves no purpose, not imported anywhere else in the project (correct me if i'm wrong).
To prevent this behavior stopPropagation property was applied to click event on the "x" buttons. Should be done for every similar button, but my main concern is for the images.

Also user cannot upload same image after clear, because upload is triggered with on:change event for hidden_upload element, so that's fixed too.

Closes: #2476

Checklist:

  • I have performed a self-review of my own code
  • I have added a short summary of my change to the CHANGELOG.md
  • My code follows the style guidelines of this project
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@mezotaken mezotaken changed the title Fixed upload dialog being showed after pressing "x" button. #2476 Fixed upload dialog being showed after pressing "x" button Oct 31, 2022
@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Nov 1, 2022

Thank you very much for the contribution @mezotaken. I've tested the code and confirms this solves the underlying issue.

@pngwn would you be able to review the code changes and if it looks good, we can merge this in?

@mezotaken
Copy link
Copy Markdown
Contributor Author

mezotaken commented Nov 1, 2022

@abidlabs as i can see from the failed static check, the click variable is used after all. Albeit only once in the table.svelte and it does exactly what disable_click does? am i correct on this?
So changing
image
to
image
should be fine? I need confirmation.

@pngwn
Copy link
Copy Markdown
Member

pngwn commented Nov 2, 2022

I won't have time to look over this for a week or so unfortunately.

@dawoodkhan82
Copy link
Copy Markdown
Collaborator

@abidlabs as i can see from the failed static check, the click variable is used after all. Albeit only once in the table.svelte and it does exactly what disable_click does? am i correct on this? So changing image to image should be fine? I need confirmation.

Yeah Looks like it was an unnecessary variable.

@dawoodkhan82
Copy link
Copy Markdown
Collaborator

tested and it fixes the issue; also code looks good. LGTM!

@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Nov 2, 2022

Thanks so much @mezotaken and @dawoodkhan82!

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

Successfully merging this pull request may close these issues.

Using the "x" button opens file load dialog automatically.

4 participants