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 removing space when using interpolation in the children #15342

florian-bd opened this issue Mar 12, 2019 · 4 comments


None yet
5 participants
Copy link

commented Mar 12, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Use JSX interpolation in Button children together with normal string

What is expected?

Space should be preserved just like when there is no interpolation

What is actually happening?

Space does not show because extra spans are created

Environment Info
antd 3.15.0
React 16.8.4
System windows
Browser Chrome

This comment has been minimized.

Copy link

commented Mar 12, 2019

Can you help us to fix this?


This comment has been minimized.

Copy link

commented Mar 16, 2019

Actually this is not a bug, it is the default behavior of the span element. Whitespace at the beginning and end of a text isn't rendered. But It seems to be related to us because we used span to separate the text. @afc163 I am not sure if we need to handle this behavior.


This comment has been minimized.

Copy link

commented Mar 20, 2019

Sorry I can't help fixing this.
I use a workaround with  . I updated the codesandbox with it.
What I don't understand is why looping through the children and create a span for each? If you do that anyway then maybe join them to get a single string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.