Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button Block: Adding spaces when typing button text does not work #14914

Closed
mapk opened this issue Apr 10, 2019 · 9 comments · Fixed by #14925
Closed

Button Block: Adding spaces when typing button text does not work #14914

mapk opened this issue Apr 10, 2019 · 9 comments · Fixed by #14925
Labels
[Block] Buttons Affects the Buttons Block Browser Issues Issues or PRs that are related to browser specific problems [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@mapk
Copy link
Contributor

mapk commented Apr 10, 2019

Describe the bug
When typing the text on a button, adding spaces between the words doesn't initially work. Going back to add the spaces later does work though.

To reproduce
Steps to reproduce the behavior:

  1. Add a Button block.
  2. Begin typing text in the button element and add spaces between words.
  3. Observe the problem.

Expected behavior
I expect that when adding spaces between the text, it remains.

Screenshots

spacerinbtn

Desktop (please complete the following information):

  • OS: OSX
  • Browser Firefox latest version
  • Gutenberg 5.4
@mapk mapk added [Type] Bug An existing feature does not function as intended [Block] Buttons Affects the Buttons Block labels Apr 10, 2019
@youknowriad
Copy link
Contributor

It seems to work properly in Chrome but break in Firefox. Is this rich text related cc @ellatrix . This would be good to fix for 5.2

@youknowriad youknowriad added Browser Issues Issues or PRs that are related to browser specific problems [Priority] High Used to indicate top priority items that need quick attention labels Apr 11, 2019
@ellatrix
Copy link
Member

It seems that #10565 caused the problem. If you remove white-space: nowrap;, the issue is gone. Not sure why this rule is there for the button block (cc @jasmussen). The solution is probably to mark the rule as !important for rich text so no block can override it.

@ellatrix
Copy link
Member

So, this issue has been around for 6 months?

@ellatrix
Copy link
Member

I'm also not sure if using text-overflow: ellipsis; is a good idea to use on a rich text area.

@ellatrix
Copy link
Member

How can you edit the text content if the content is trimmed?

@jasmussen
Copy link
Contributor

Sorry about that!

If you remove white-space: nowrap;, the issue is gone.

Incidentally I was just testing this PR by @talldan: #10128 (comment) — and this appears to change that rule and incidentally fix this. Correct?

I'm also not sure if using text-overflow: ellipsis; is a good idea to use on a rich text area.
How can you edit the text content if the content is trimmed?

Here's the full bit.

	// Don't let the placeholder text wrap in the variation preview.
	.editor-block-preview__content & {
		max-width: 100%;

 		.wp-block-button__link {
			max-width: 100%;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
		}
	}

That was the purpose of the PR: to fix the problem with the button block in the variation preview, and nowhere else. That's why it's scoped to be inside .editor-block-preview__content. I don't know why it escapes that rule?

@ellatrix
Copy link
Member

@jasmussen What's "variation preview"? Why does it only need to trimmed there?

@ellatrix
Copy link
Member

// Don't let the placeholder text wrap in the variation preview.

This comment doesn't explain why.

And no worries, I should have added !important to the rule. :)

@jasmussen
Copy link
Contributor

What's "variation preview"? Why does it only need to trimmed there?

It's this:

variation preview

It's a little bit hacky, and uses scale to size down to fit. By eliding the text, the preview is more useful for the button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block Browser Issues Issues or PRs that are related to browser specific problems [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants