close
Skip to content

Fix: “Copy” button misaligned in Share Preview Link section in Customizer#11003

Closed
hbhalodia wants to merge 5 commits intoWordPress:trunkfrom
hbhalodia:fix/issue-64688
Closed

Fix: “Copy” button misaligned in Share Preview Link section in Customizer#11003
hbhalodia wants to merge 5 commits intoWordPress:trunkfrom
hbhalodia:fix/issue-64688

Conversation

@hbhalodia
Copy link

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

  • When button is disabled, the disabled CSS has !important, which takes precedance of the styles that are added specific to that preview copy element.
  • Added !important to transform element for the specific element.

Use of AI Tools


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@hbhalodia hbhalodia changed the title “Copy” button misaligned in Share Preview Link section in Customizer Fix: “Copy” button misaligned in Share Preview Link section in Customizer Feb 23, 2026
@github-actions
Copy link

github-actions bot commented Feb 23, 2026

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 hbhalodia, joedolson, huzaifaalmesbah.

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

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@huzaifaalmesbah
Copy link
Member

We should avoid !important where possible since it just escalates specificity and makes future overrides harder.

Using the absolute positioning approach with:

.preview-link-wrapper .customize-copy-preview-link.preview-control-element.button {
	margin: auto 0;
	position: absolute;
	top: 0;
	bottom: 0;
	right: 0;
}

is much cleaner. It vertically centers the button without relying on transform, so we don’t clash with buttons.css setting transform: none !important on disabled states.

@hbhalodia
Copy link
Author

hbhalodia commented Feb 23, 2026

We should avoid !important where possible since it just escalates specificity and makes future overrides harder.

Using the absolute positioning approach with:

.preview-link-wrapper .customize-copy-preview-link.preview-control-element.button {
	margin: auto 0;
	position: absolute;
	top: 0;
	bottom: 0;
	right: 0;
}

is much cleaner. It vertically centers the button without relying on transform, so we don’t clash with buttons.css setting transform: none !important on disabled states.

Hi @huzaifaalmesbah, Thanks for the review. I am indeed inclined towards to not use ! important, I tried the above approach earlier, but it was not giving the expected results. See the below image on adding the same CSS giving unexpected output.

Screenshot 2026-02-23 at 8 12 58 PM

Even if we remove the transform property from the element, the button disabled will add the transform property anyways.

So IMO, currently overriding the button disabled behavior for this customization could be acceptable.

Although, I will wait for others to review as well.

Thanks 🙇

@joedolson
Copy link
Contributor

There are a couple additional changes needed here; I'm just going to push them to this PR, rather than try to describe them. They both relate to after saving changes; once the link is expanded, it becomes longer than the containing region & goes under the button. To accommodate, the button can't have a transparent background & the generated content needs to be increased in height to match the button.

@hbhalodia
Copy link
Author

hbhalodia commented Feb 24, 2026

There are a couple additional changes needed here; I'm just going to push them to this PR, rather than try to describe them. They both relate to after saving changes; once the link is expanded, it becomes longer than the containing region & goes under the button. To accommodate, the button can't have a transparent background & the generated content needs to be increased in height to match the button.

Thanks @joedolson, For the review and update. I see the changes you added and looks good.

I see the same issue when button is disabled for longer links, we should update the background color to #fff ! important as well for disabled state for preview button element. See below,

Screenshot 2026-02-24 at 12 49 58 PM

I am updating the PR with changes for now, will revert if we go with any other approach.

After

Screenshot 2026-02-24 at 12 52 02 PM

Thanks,

@github-actions
Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61730
GitHub commit: 6727d18

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Feb 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.

3 participants