Skip to content

Theme Directory: Indicate upload progress on the theme upload form#735

Closed
obenland wants to merge 3 commits into
WordPress:trunkfrom
obenland:themes/upload-button-progress-state
Closed

Theme Directory: Indicate upload progress on the theme upload form#735
obenland wants to merge 3 commits into
WordPress:trunkfrom
obenland:themes/upload-button-progress-state

Conversation

@obenland

@obenland obenland commented Jul 24, 2026

Copy link
Copy Markdown
Member

Fixes #7852

As noted in #438, the Theme Directory upload page has no visible "upload in progress" state on its submit button in the new (2024) theme — the old theme relied on button[disabled] styles that no longer exist.

This change makes the upload state explicit, following the pattern already used by the Plugin Directory upload form (data-uploading-label):

  • When the form submission proceeds, the submit button is disabled and its label changes from Upload to Uploading….
  • A #upload_button:disabled style greys the button out (opacity: 0.6, cursor: not-allowed), matching the disabled-button treatment in wporg-plugins-2024. Since neither wporg-parent-2021 nor wporg-mu-plugins ship :disabled button styles, the style is attached to an inline-only wporg-themes-upload handle via wp_add_inline_style() so it works in both the old and new theme; the submit handler is attached the same way via wp_add_inline_script() (footer, after the form markup).
  • The previous inline onsubmit handler disabled the button unconditionally — including when the 2FA revalidation script cancels the submission to show its modal, which left the button stuck disabled if the modal was dismissed. The new handler defers until after all submit handlers have run and checks event.defaultPrevented, so the button state only changes when the upload is actually underway. Once revalidation completes and the form is re-submitted via requestSubmit(), the state is applied as usual.

The button markup keeps the id="upload_button" class="button" prefix so the theme-upload-form block in wporg-themes-2024 continues to rewrite it into a wp-block-button__link; the new data-uploading-label attribute is carried through that rewrite (verified against the block's preg_replace).

Verified in the local theme-directory wp-env environment (Chromium): the plain submit path flips the button to disabled + "Uploading…", and — with the production wporg-two-factor revalidation script injected (the local env stubs it out) — the button stays "Upload" while the revalidation modal is open, remains usable if the modal is dismissed, and flips to "Uploading…" once revalidation completes and the form re-submits.

🤖 Generated with Claude Code

Disables the submit button and swaps its label to 'Uploading…' once the
form submission actually proceeds, greying the button out via a
:disabled style. The state is only applied when no other submit handler
(such as the 2FA revalidation modal) cancels the submission, so the
button no longer gets stuck in a disabled state when revalidation is
dismissed.

See #7852.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 24, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props obenland.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

obenland and others added 2 commits July 24, 2026 13:54
…ssets.

Registers inline-only wporg-themes-upload handles instead of hardcoding
<script> and <style> tags in the shortcode output. The style prints in
the head, the script in the footer after the form markup.

See #7852.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes the PHPCS EnqueuedResourceParameters error on the inline-only
handles.

See #7852.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bazza bazza closed this in d3e4041 Jul 24, 2026
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.

2 participants