Actually it's impossible to use checkboxes and radio-buttons inside the input-field div.
I created the following CodePen to show the problem and solution.
https://codepen.io/alexisdiel/pen/gxwPWj
They simply don't works
Also reported at https://github.com/InfomediaLtd/angular2-materialize/issues/342
Thanks. I had just come across this myself. Your fix has worked for me
This seems to occur starting with version 0.100.0. Downgrading to 0.99.0 fixed it for me.
Fixed in v1-dev, the temporary fix for this is to not put checkboxes and radio buttons inside input-field
I have a production code where checkboxes are still working as expected, also inside input-field div. I just encountered the problem in the development environment. Therefore I presume it was introduced relatively recently? I really would not like to introduce the temporary workaround to the whole codebase but on the other hand, I don't want the problem to propagate to the production environment with the update I need to make. Could you shed some light on where/when the problem was introduced and what to do/avoid in order to keep the production code working?
The best solution is to not wrap the checkboxes in the .input-field class.
Another solution is to add
.input-field label {
pointer-events: auto;
}
But you say it's been fixed recently - so I assume this manual addition won't be needed some time "soon", right? BTW - I went through the recent releases using @alexisdiel's codepen and the problem seems to have been introduced in v0.100.0. I might freeze the Gemfile version to 0.99.0 until the next release is out. Is that something you'd agree to call a temporary solution? Without the input-field wrapper, the current layout breaks badly. It would be a surely non-trivial effort to rewrite views in the whole (rather sizable) application to remove all the wrappers and keep the layout intact.
Not necessarily a 'closed' solution if the solution is to take them outside of input-fields.
meteor-autoform places the 'input-field' class on the 'afFormGroup' template automatically.
i guess i have to use custom templates now.
It's a 'closed' solution because it has been fixed for the next release
@tdotholla - unless you need something out of the later versions, you might use 0.99.x until the next release is out. I didn't receive any response to my humble question above but it seems to work for me so far.
Ah thanks @silverdr,
Implementing @Dogfalo solution is working out perfectly for me for now.
.input-field label {
pointer-events: auto;
}
Has anyone addressed the elephant in the room....why did the materialize team set the pointer-events property to 'none' on [type="checkbox"]:checked and [type="checkbox"]:not(:checked)?
@MarvelMoe The change was targeted for input text fields, but we didn't anticipate that many people had put checkboxes inside .input-field as well
@Dogfalo - I believe it is because putting form inputs other than text in there seems natural when text ones are already there. Besides not really knowing that some type of input elements need to be treated differently than other (e. g. text vs. checkbox) and besides layouts behaving quite differently (than expected) when checkboxes are not placed inside .input-field.
Also aldeed: autoforms had them formatted as previously described, so the
change broke apps using autoforms.
On Mon, Dec 18, 2017 at 8:36 AM silverdr notifications@github.com wrote:
@Dogfalo https://github.com/dogfalo - I believe it is because putting
form inputs other than text in there seems natural when text ones are
already there. Besides not really knowing that some type of input elements
need to be treated differently than other (e. g. text vs. checkbox) and
besides layouts behaving quite differently (than expected) when checkboxes
are not placed inside .input-field.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Dogfalo/materialize/issues/5062#issuecomment-352426942,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6ThTpBC12JJiyl1VeSbclp-dC111F9ks5tBmo_gaJpZM4Orn21
.
I guess my issue is that in the example on http://materializecss.com/forms.html it doesn't mention that anything else is needed to make checkboxes function properly.
having same issue of the checkbox not able to uncheck when clicked. my html is
<input type="checkbox" name="remember" class="filled-in" checked="checked" value="1" />
clearly im using this for logins with the laravel php framework so right now the system is remembering my users.
Has this eventually been fixed and a fix released? Or is it still "fixed in next release"?
Most helpful comment
The best solution is to not wrap the checkboxes in the
.input-fieldclass.Another solution is to add