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

Issues with Tooltips in Form Labels since upgrade to 2.8 #5222

Closed
acomito opened this issue Mar 8, 2017 · 8 comments
Closed

Issues with Tooltips in Form Labels since upgrade to 2.8 #5222

acomito opened this issue Mar 8, 2017 · 8 comments
Assignees
Labels
🐛 Bug Ant Design Team had proved that this is a bug.

Comments

@acomito
Copy link

acomito commented Mar 8, 2017

Environment(required)

  • antd version: 2.8.0
  • OS and its version: mac
  • Browser and its version: Safari and Chrome

What did you do? Please provide steps to re-produce your problem.

I tried to nest a tooltip in a form label like the registration form example:

https://ant.design/components/form/

In the past, this nesting of tooltips has worked. I think something may have broken on the 2.8.0 version?

What do you expected?

It was working, but does not work anymore. It is also worth noting that tooltips work outside normally, but just not when passed as a prop for form label.

What happen?

I did not see a tooltip pop up.

Re-producible online demo

http://codepen.io/anon/pen/mWRWzm?editors=0011

// You should fork and save if you had updated this CodePend and want to send it to others.
// Note: antd.locales are only support by `dist/antd`
const { LocaleProvider, Switch, Form, Tooltip, Icon, locales, version } = antd;
moment.locale('en');


const FormItem = Form.Item;

const FormArea = Form.create()(React.createClass({
  getInitialState () {
    return {};
  },
   render() {

      const { getFieldDecorator } = this.props.form;
     return (
      <Form onSubmit={()=>console.log('submit')} >
        <FormItem label={(
            <span>
              Nickname&nbsp;
              <Tooltip title="What do you want other to call you?">
                <Icon type="question-circle-o" />
              </Tooltip>
            </span>
          )}>
            {getFieldDecorator('switchField', { rules: [{ required: false }],valuePropName: 'checked' })(
              <Switch />
            )}
          </FormItem>
      </Form>
     );
  },
}));
  


ReactDOM.render(
  <div>
    <p className="version">antd version: {version}</p>
    <LocaleProvider locale={locales.en_US}>
         <div>
         <Tooltip title="What do you want other to call you?">
          <Icon type="question-circle-o" />
         </Tooltip>
         <FormArea />
           
        </div>
    </LocaleProvider>
  </div>
, mountNode);
@benjycui
Copy link
Contributor

benjycui commented Mar 9, 2017

Actually, it works fine, even in your demo.

Just make Tooltip[title] shorter, you will know what I said:

- <Tooltip title="What do you want other to call you?">
+ <Tooltip title="?">

@benjycui benjycui closed this as completed Mar 9, 2017
@benjycui benjycui added the Usage label Mar 9, 2017
@acomito
Copy link
Author

acomito commented Mar 9, 2017

hmm... but wont most use cases call for a tooltip with a sentence or sentences rather than a few characters? I guess I'm confused because it was working prior to updating to 2.8.

@afc163 afc163 reopened this Mar 9, 2017
@acomito
Copy link
Author

acomito commented Mar 9, 2017

I'm trying to track down the issue. This is the same code, same browser. One is 2.7.2 and the other is 2.8:

http://g.recordit.co/aDLz03GA9l.gif

http://g.recordit.co/fP9vjg1pUB.gif

Even my layout seems to shift for some reason. i'm going through the changelog now.

@afc163
Copy link
Member

afc163 commented Mar 9, 2017

It is our bug.

@afc163 afc163 added 🐛 Bug Ant Design Team had proved that this is a bug. and removed Usage labels Mar 9, 2017
@acomito
Copy link
Author

acomito commented Mar 9, 2017

oh okay, thanks @afc163!

Update:

Tooltips seem to work when you set layout='inline' but doesn't work with vertical or with no layout set.

@afc163
Copy link
Member

afc163 commented Mar 9, 2017

@afc163
Copy link
Member

afc163 commented Mar 9, 2017

We should use @media (max-width: @screen-sm) { over @media (min-width: @screen-sm) {. Don't change default styles of form item in 2.7.x.

@lock
Copy link

lock bot commented May 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 Bug Ant Design Team had proved that this is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants