question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FromControl label should have "for" attribute

See original GitHub issue

Describe the bug FromControl label should have “for” attribute, so when user click on the label, the input gets automaticaly focused.

To Reproduce Steps to reproduce the behavior:

  1. Create simple formControl with label and inputField.
  2. Click on the label.
  3. Nothing happens.

Expected behavior Cursor will appear inside the inputField (or, in case of chackbox, the checbox is toggled)

Additional context Or, you can nest the <input>inside<label>` to get the same behaviour.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
chausknechtcommented, Jun 15, 2021

Good catch - we will repair this soon, as we are working on some improvements for the formControl concept currently. So I will integrate this issue when solving #440 issue.

0reactions
chausknechtcommented, Jun 21, 2021

storeOf factory also needs the default ID uniqueId()!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using label elements to associate text labels with form controls
A label is attached to a specific form control through the use of the for attribute. The value of the for attribute must...
Read more >
The Label element - HTML: HyperText Markup Language | MDN
The value of the for attribute must be a single id for a labelable form-related element in the same document as the <label>...
Read more >
Form controls must have labels
The preferred technique for labeling form controls is by reference: First, include an id attribute on the form control to be labeled; then...
Read more >
Form <input> elements should have a visible label | Axe Rules
The aria-label attribute allows you to add a label directly to pretty much any HTML element, including form elements, paragraphs, tables, and more....
Read more >
Should labels ALWAYS have 'for' attribute? - CSS-Tricks
It's always a good idea to give a label a 'for' attribute and link it to the control's ID. Like un-traq-ed said, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found