Make WordPress Core

Opened 5 weeks ago

Closed 6 days ago

#63561 closed enhancement (fixed)

The media upload button is not disabled when no image has been uploaded

Reported by: karinchristen's profile karinchristen Owned by: joedolson's profile joedolson
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch commit
Focuses: ui, administration Cc:

Description

This issue only occurs when the "old image uploader" is used e.q. Browser upload and not with the multi-file uploader. See attached screenshot.

Attachments (1)

upload-button-not-disabled.png (113.4 KB) - added by karinchristen 5 weeks ago.

Download all attachments as: .zip

Change History (13)

This ticket was mentioned in PR #8966 on WordPress/wordpress-develop by @ocean90.


5 weeks ago
#1

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/63561

Before After
https://github.com/user-attachments/assets/7a6157e4-5ca2-4749-8ca5-dd54a93e2b1f https://github.com/user-attachments/assets/a7f87c7e-21c0-4191-9fc9-bc6701de2bf1

This PR was created during an internal contributor day @wearerequired.

@karinchristen commented on PR #8966:


5 weeks ago
#2

UX is much better now!

@stefan.velthuys commented on PR #8966:


5 weeks ago
#3

I agree, UX is definitely improved 👍

#4 @joedolson
5 weeks ago

  • Milestone changed from Awaiting Review to 6.9
  • Owner set to joedolson
  • Status changed from new to accepted

#5 @dhrumilk
5 weeks ago

Absolutely, the UX has definitely improved! 👍

#6 @rollybueno
3 weeks ago

  • Keywords needs-testing added

#7 @rollybueno
3 weeks ago

Reproduction Report

Description

This report validates whether the issue described in the ticket can be reproduced.

Specifically, when using the browser uploader in the Media Library (via MediaAdd Newbrowser uploader), the Upload button remains active even if no file has been selected.

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 137.0.0.0
  • OS: Linux
  • Theme: Twenty Twenty-Five 1.2
  • MU Plugins: None activated
  • Plugins:
    • Query Monitor 3.18.0
    • Test Reports 1.2.0
    • Transients Manager 2.0.7

Actual Results

  1. ✅ Error condition occurs (reproduced).
    • Navigated to Media → Add New.
    • Switched to browser uploader.
    • Clicked the Upload button without selecting a file.
    • Result: Redirected to a wp_die() error page due to missing upload file.

Additional Notes

  • The Upload button is not disabled when no file is selected.
  • Clicking it without selecting a file results in a server-side error instead of being blocked on the client side.
  • This could be confusing for users expecting a disabled button until a file is chosen.

Supplemental Artifacts

Classic browser uploader for single file. You can see in this screenshot on where you can find it.
https://i.imgur.com/twboR58.png

The single file upload page. You can see that the button is not disable by default, or when the file filed is empty.
https://i.imgur.com/cQ75Y5y.png

If you clicked that without file uploaded, you get this old classic wp_die().
https://i.imgur.com/RUBzvn9.png

#8 @rollybueno
3 weeks ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/8966

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 137.0.0.0
  • OS: Linux
  • Theme: Twenty Twenty-Five 1.2
  • MU Plugins: None activated
  • Plugins:
    • Query Monitor 3.18.0
    • Test Reports 1.2.0
    • Transients Manager 2.0.7

Actual Results

  1. ✅ Issue resolved with patch.
    • Navigated to Media → Add New → browser uploader.
    • Confirmed that the Upload button is now correctly disabled when no file is selected.
    • Also confirmed that if a file is selected and then upload is canceled, the Upload button reverts back to the disabled state.
    • Attempting to click the button without selecting a file no longer triggers a wp_die() error because.. ..well you can't click it 👍 😅.

Additional Notes

  • To test the patch, I fetched the pull request locally using: git fetch upstream pull/8966/head:pr-8966 && git checkout pr-8966
  • The UI behavior now aligns with expected usability and accessibility.
  • No regressions observed in standard media uploading or drag-and-drop functionality.

Supplemental Artifacts

Before the patch:
https://i.imgur.com/cQ75Y5y.png

After the patch: You can't click it by default
https://i.imgur.com/WrIviOd.png

After the patch: Conditional logic is working. You can only click if you have selected a file. If you remove that, it reverts back to disabled.
https://i.imgur.com/yx4ZoDv.png

#9 @rollybueno
3 weeks ago

  • Keywords needs-testing removed

Tested the patch and it's working. This has my 👍

@mukesh27 commented on PR #8966:


7 days ago
#10

https://github.com/user-attachments/assets/45a4e2fa-e082-4057-a3ca-a07fe5c53aa9

Working fine for me

#11 @mukesh27
7 days ago

  • Keywords commit added

Mark ready for commit.

#12 @ocean90
6 days ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 60449:

Media: Disable upload button in browser's built-in file uploader if no file is selected.

Props karinchristen, krokodok, stefanvelthuys, hubersen, joedolson, mukesh27, rollybueno, ocean90.
Fixes #63561.

Note: See TracTickets for help on using tickets.