Skip to content

Make upload new icon button open the file picker - #1159

Open
mchugh19 wants to merge 2 commits into
nextcloud:masterfrom
mchugh19:fix/icon-upload-button-master
Open

mchugh19 wants to merge 2 commits into
nextcloud:masterfrom
mchugh19:fix/icon-upload-button-master

Conversation

@mchugh19

Copy link
Copy Markdown

Fixes #1113

Problem

On Administration → External sites, clicking "Upload new icon" did nothing: no file picker opened, no network request fired, no console error.

Root cause

The hidden <input type="file"> was triggered via native label forwarding through an NcButton wrapped in <label for="uploadicon">. NcButton attaches its own click listener and swallows the event before native label → input forwarding happens (a <button> inside a <label> is also invalid interactive content, so browsers won't do label activation anyway).

Fix

Drop the <label> wrapper and give the NcButton an explicit @click handler that programmatically clicks the hidden input through a Vue template ref. Triggering the input directly was already proven to work in the issue thread, and the upload backend path is unchanged.

Testing

Built from this branch and deployed the resulting js/external-admin.mjs (+ matching CSS) onto a Nextcloud 34 / External 9.0.1 instance: the file picker now opens, the upload completes with "Icon uploaded successfully", and the icon appears in the list. Page styling verified intact.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI
    (but verified by a human)

The hidden file input was triggered via native label forwarding through
an NcButton wrapped in <label for="uploadicon">. NcButton attaches its
own click handler and renders a <button> inside the <label> (invalid
interactive content), so the click never reached the input and no file
picker opened.

Replace the label with an explicit @click handler that programmatically
clicks the hidden input via a template ref.

Fixes nextcloud#1113
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Upload new icon" doesn't work

1 participant