Skip to content

htmlfor in LabelHTMLAttributes does not work #1183

@mmakrzem

Description

@mmakrzem

Stencil version:

 @stencil/core@0.15.0

I'm submitting a:

[X] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
I want to create a label for a checkbox so in my stencil component's render function I wrote something like this:

<label htmlfor={this.id}>My Label Text</label>
<input type="checkbox" id={this.id}></input>

Expected behavior:
I was expecting that if I click on "My Label Text" that my checkbox's state would toggle. However that doesn't happen.

Steps to reproduce:
I noticed in jsx.d.ts

   interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
        form?: string;
        htmlFor?: string;
        htmlfor?: string;
    }

So I switched from htmlfor to htmlFor (with a capital letter) and now the label works as expected. So there seems to be a bug somewhere in the stencil code for handling the htmlfor (lower case) attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions