fix: keep the submit button from growing while the form is submitting - #2989
Open
johansolve wants to merge 1 commit into
Open
fix: keep the submit button from growing while the form is submitting#2989johansolve wants to merge 1 commit into
johansolve wants to merge 1 commit into
Conversation
The spinner is appended inside the submit button and carried 2rem of padding, so the button grew while the request was pending and shrank back afterwards. The ring is drawn absolutely positioned by :before with its own dimensions, so the span only needs to be the size of the ring. The ring also defaulted to white, which is invisible on a light button. Since the span sits inside the button, currentColor picks up the button's own text colour instead.
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.
Closes #2986.
Summary
The loading spinner is appended as a
<span class="spinner">inside the submit button, and it carriedpadding: 2rem. The button therefore grew — mostly in height — for as long as the submission was in flight, then shrank back. On a centered button the surrounding layout moves with it.The ring itself is drawn by
:beforewithposition: absolute, its ownwidth/heightand negative margins for centering, so the span never needed a box of its own. It is now sized to the ring instead.Second change on the same element: the ring's colour defaulted to
white, which assumes a dark button.--submit-coloris only set when the user picks a submit text colour in the block, so out of the box the spinner is white — invisible on any light or brightly coloured button. Since the span sits inside the button,currentColorinherits the button's own text colour and works on both light and dark.Screenshots
Measured on a 46px-tall button with a lime background and dark text:
Test instructions
The change is two declarations in
style.scss. I verified the compiled output and the resulting geometry in a browser against a real form, but I could not run the E2E suite locally — it needs wp-env and Docker was unavailable on this machine.If you would rather keep
whiteas the fallback for backwards compatibility, dropping the padding alone still fixes the reported bug — happy to trim the PR to that.Checklist before the final review
This is a visual change by definition — the spinner is the visual element in question, and the button around it stops moving. No tests included: asserting "the button does not change height mid-request" needs an intercepted, held-open submission in E2E. I can write that if you want it.
Created with help of Claude Code.