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

Radio does not show checked state when wrapped in a tooltip #13206

Closed
henkvhest opened this issue Oct 11, 2018 · 3 comments
Closed

Radio does not show checked state when wrapped in a tooltip #13206

henkvhest opened this issue Oct 11, 2018 · 3 comments
Labels
component: tooltip This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@henkvhest
Copy link
Contributor

I tried wrapping a RadioButton with a tooltip because having labels in my app will probably not fit in the UI spacewise. The tooltip appears but the button itself does not show to be appear to be selected when I click on it

  • [x ] This is not a v0.x issue.
  • [ x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I expect the radio button to be checked when I click on it

Current Behavior

The radiobuttons stays unchecked.

Steps to Reproduce

See the codesandbox below, the uppermost radiobuttons don't show a selected styling and are provided with a tooltip
https://codesandbox.io/s/714715lvvx

@eps1lon
Copy link
Member

eps1lon commented Oct 11, 2018

That's most likely a limitation of our current implementation. We already have a discussion in #12921 that addresses this.

@eps1lon eps1lon added the component: radio This is the name of the generic UI component, not the React module! label Oct 11, 2018
@henkvhest
Copy link
Contributor Author

As in mentioned in #12921, it seems to be related to the RadioGroup. I was able to get tooltips working with separate radiobuttons for now though

@oliviertassinari oliviertassinari self-assigned this Oct 17, 2018
@oliviertassinari oliviertassinari added component: tooltip This is the name of the generic UI component, not the React module! and removed component: radio This is the name of the generic UI component, not the React module! labels Oct 17, 2018
@oliviertassinari oliviertassinari removed their assignment Oct 22, 2018
@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists and removed component: tooltip This is the name of the generic UI component, not the React module! labels Feb 3, 2019
@oliviertassinari
Copy link
Member

@henkvhest You can workaround the problem with this pattern:

const Wire = ({ children, ...props }) => children(props);

// …

<RadioGroup
  aria-label="Gender"
  name="gender1"
  className={classes.group}
  value={this.state.value}
  onChange={this.handleChange}
>
  <Wire value="female">
    {props => (
      <Tooltip title="text">
        <FormControlLabel
          control={<Radio />}
          label="Female"
          {...props}
        />
      </Tooltip>
    )}
  </Wire>

https://codesandbox.io/s/zr7x1xx32x

Now, @eps1lon is right it's a core issue with #12921. But directly linked to a radio group limitation. I'm closing as a duplicate of #2225.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tooltip This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants