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

[Chips] Choice chips not working #284

Open
joyzhong opened this issue Mar 20, 2020 · 1 comment
Open

[Chips] Choice chips not working #284

joyzhong opened this issue Mar 20, 2020 · 1 comment

Comments

@joyzhong
Copy link

(Copying over from issue that was originally filed as material-components/material-components-web#5715)

Bug report

Choice chips simply don't work.
If you set a chip to be selected at first, you see it, but as soon as you interact with it or others, nothing works anymore.

Steps to reproduce

  1. Go to https://material-components.github.io/material-components-web-catalog/#/component/chips
  2. Try the Choice Chips demo

Actual behavior

You can't select any chip

Expected behavior

You should be able to change the selected chip by clicking another one.

Screenshots


See this gifv

Your Environment:

Software Version(s)
MDC Web v5.1.0
Browser Chrome v80.0.3987.132
Operating System Windows 10
@hljanelam
Copy link

hljanelam commented Jul 23, 2020

I have experienced this also and I have found out where my mistake was.

To initialize tag (e.g. int tag = 0;) for the selected choice, you need to initialize it outside the ChipsChoice widget and somewhere inside the class. My mistake was that I initialized it inside ChipsChoice widget and variable tag will always stay on the same Chip cuz unchanged, leading to the buttons not working.

Maybe you can check if you share the same problem as well. It's working fine now for me.

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

2 participants