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

Hover issues with disabled buttons #1495

Closed
Kagami opened this issue Aug 24, 2015 · 10 comments
Closed

Hover issues with disabled buttons #1495

Kagami opened this issue Aug 24, 2015 · 10 comments
Labels
bug 🐛 Something doesn't work

Comments

@Kagami
Copy link

Kagami commented Aug 24, 2015

I experience several issues with disabled property of FlatButton and RaisedButton.

1. Hovering active button in the same row with disabled button don't trigger hover style.

I can reproduce it in both Firefox 40 and 43 but can't reproduce in Chrome.

Code:

  render() {
    return (
      <div style={{marginTop: 100, textAlign: "center"}}>
        <RaisedButton label="1" disabled/>
        <RaisedButton label="2" />
      </div>
    );
  }

Demo:
3

2. Moving mouse over disabled button make it hovered after enabling.

I can reproduce it in both Chrome and Firefox.

Code:

  enable() {
    this.setState({enabled: true});
  },
  render() {
    return (
      <div style={{marginTop: 100, textAlign: "center"}}>
        <FlatButton label="1" disabled={!this.state.enabled} />
        {' '}
        <RaisedButton label="2" onClick={this.enable} />
      </div>
    );
  }

Demo:
4

@Kagami Kagami changed the title Disabled button issues Hover issues with disabled buttons Aug 24, 2015
@mbrookes
Copy link
Member

Similar issue to the second one here - I'm disabling a button in response the the user clicking that button (a delete button that is disabled when the selected items are deleted), but when the button is reenabled programatically (selection of additional items), the hover-state style from when it was disabled is present.

[Aside: @Kagami - how did you produce these animated gifs? They were perfect for me to see at a glance that it's the same symptom I'm seeing. Nice job!]

@Kagami
Copy link
Author

Kagami commented Aug 24, 2015

how did you produce these animated gifs?

I'm using 3 sequential ffmpeg commands:

  1. Grab the screen to lossless H.264

    ffmpeg -f x11grab -show_region 1 -framerate 24 -video_size WxH -i :0+X,Y -crf 0 -preset fast -pix_fmt +yuv420p -y out.mkv
    
  2. Generate palette

    ffmpeg -ss SEEK -i out.mkv -t DURATION -vf crop=x=X:w=W,palettegen -y palette.png
    
  3. Convert to gif

    ffmpeg -ss SEEK -i out.mkv -i palette.png -t DURATION -lavfi '[0:v]crop=x=X:w=W[a];[a][1:v]paletteuse' -y out.gif
    

(I adjust some options/add other filters depending on the encode of course.)

Probably not ideal, but it works good enough for me.

@lynndylanhurley
Copy link
Contributor

I'm seeing this issue as well.

@alitaheri alitaheri added the bug 🐛 Something doesn't work label Dec 8, 2015
@mikechabot
Copy link

Once a button returns from being disabled (i.e. no longer disabled), the styling appears as though a user is hovering on it. That said, if you do hover over the button, then move the cursor away, the button returns to the appropriate classing (i.e. primary={true})

@orporan
Copy link
Contributor

orporan commented Mar 7, 2016

I'm seeing the same issue

@iofjuupasli
Copy link

Tooltip doesn't dissapear for IconButton after mouseleave.

Workaround is to use own class to style button as disabled instead of disabled property

@tintin1343
Copy link
Contributor

@Kagami @orporan : were you able to solve the issue using the above suggestion? Do let us know.

@mwildehahn
Copy link

I'm seeing something similar to this.

I have a button which when clicked, gets disabled and opens a form. When the user submits the form, the button is re-enabled. When the button is re-enabled, hover is still set to true. It looks like this is happening because the hover state is unset within onMouseLeave, but if the button is disabled while you're still hovering over it, onMouseLeave will never be called.

I think having a componentWillReceiveProps func that does something like:

if (nextProps.disabled && this.state.hovered) {
  this.setState({ hovered: false })
}

would fix the weird behavior.

I can't think of a case where the button is disabled, but you still want to maintain an internal hovered state.

@mbrookes
Copy link
Member

Closed by #4626

@cjnaude
Copy link

cjnaude commented Sep 5, 2017

Both of these issues seem to still be present in 0.18.7. Did #4626 not fix second issue at least?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

No branches or pull requests

10 participants