Theme Directory: Indicate upload progress on the theme upload form#735
Closed
obenland wants to merge 3 commits into
Closed
Theme Directory: Indicate upload progress on the theme upload form#735obenland wants to merge 3 commits into
obenland wants to merge 3 commits into
Conversation
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>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):#upload_button:disabledstyle greys the button out (opacity: 0.6,cursor: not-allowed), matching the disabled-button treatment inwporg-plugins-2024. Since neitherwporg-parent-2021norwporg-mu-pluginsship:disabledbutton styles, the style is attached to an inline-onlywporg-themes-uploadhandle viawp_add_inline_style()so it works in both the old and new theme; the submit handler is attached the same way viawp_add_inline_script()(footer, after the form markup).onsubmithandler 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 checksevent.defaultPrevented, so the button state only changes when the upload is actually underway. Once revalidation completes and the form is re-submitted viarequestSubmit(), the state is applied as usual.The button markup keeps the
id="upload_button" class="button"prefix so thetheme-upload-formblock inwporg-themes-2024continues to rewrite it into awp-block-button__link; the newdata-uploading-labelattribute is carried through that rewrite (verified against the block'spreg_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-factorrevalidation 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