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

Wrapping a Tooltip around a DISABLED button causes the Dom to wrap a span around that button #18842

Closed
1 task done
nora-white opened this issue Sep 16, 2019 · 2 comments
Closed
1 task done
Assignees

Comments

@nora-white
Copy link

nora-white commented Sep 16, 2019

Reproduction link

https://codepen.io/LittlePupper420/pen/GRKXqbL

Steps to reproduce

Inside of an Antd Tooltip, render an antd Button component that has the disabled attribute applied to it.

What is expected?

That the button renders as a Button only, with no wrapping <span></span>. The tooltip should still appear on hover. Should look like this:
<button disabled class='my-class-name my-other-class-name ant-btn'>...</button>

What is actually happening?

The button is wrapped with a , and the custom classNames that I have given my antd Button are moved into the span. The Tooltip still appears. So it looks like this:
<span class='my-class-name my-other-class-name'> <button disabled class='ant-btn'>...</button> </span>

Environment Info
antd 3.23.2
React React 16.9
System Mac
Browser Chrome

In my scenario, I have a button that is enabled and disabled based on a condition. When it is still enabled, the behaviour is normal, there is no <span></span> wrapping the <button></button>. When the button becomes disabled, suddenly the classNames are removed from my button and given to the span that I never wanted in the first place. This causes my CSS to be incorrectly applied.

In order to get around this issue, I'm having to wrap my Button in a <div>. Despite this working, this does not seem like a good fix.

Why does this behaviour happen when there is no change to the behaviour of the Tooltip?

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

No branches or pull requests

3 participants