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.

`focus-in` vs `focusIn` on text inputs vs checkboxes

See original GitHub issue

On text inputs, both focus-in and focusIn work (although the handlers are passed different arguments), while on checkboxes, only focusIn does. See: https://ember-twiddle.com/6f82aa1cce20e0831e285c172ca7e998

I found this difference fairly surprising (and wasted more time than I care to admit trying to track down why actions attached to focus-in on my checkboxes weren’t firing)

The cause of the behavior difference is that focusIn is the default event name, while the action assigned to focus-in is used as the default focusIn handler by the TextSupport mixin (thanks for the pointer, @alexspeller!). I haven’t really figured out why this distinction exists (historical reasons, perhaps?), but it would be nice if this was consistent (or at least made more clear in the docs). At the moment the sections for actions and checkboxes are actually adjacent on the input helpers page, so it literally reads:

Event Names must be dasherized.

Checkboxes

You can also use the {{input}} helper to create a checkbox by setting its type

which is fairly misleading.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jayjayjpgcommented, Oct 2, 2018

@gabrielgrant Thank you for the descriptive issue and the reproduction in the Twiddle! I’m myself not aware why both event name styles exist for the input[type=text] helper, but from a learning perspective I think the Guides should just mention the one type of wording that works for all input helpers as you already suggested.

0reactions
lockscommented, Feb 29, 2020

Thanks for the update, closing it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

on focus only for input type text or tel, not radio or checkboxes
The problem is, I want to exclude radio buttons and checkboxes ..and only use it for input type tel or text . How...
Read more >
Introduction to Focus - web.dev
Focus refers to which control on the screen (an input item such as a field, checkbox, button, or link) currently receives input from...
Read more >
Focus Order - Understanding Success Criterion 2.4.3 - W3C
If no scripting or tabindex attributes are used, the navigation order is the order that components appear in the content stream. (See HTML...
Read more >
Element: focusin event - Web APIs | MDN
The opposite of focusin is the focusout event, which fires when the element has lost focus. The focusin event is not cancelable.
Read more >
Focusing on Focus Styles | CSS-Tricks
However, these aren't the only forms of input available to us. Keyboards are ubiquitous and can do just about anything a mouse or...
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