Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

boolean input: <label> gets tabindex option if <input> has it #859

Closed
tom-kuca opened this Issue Jun 14, 2012 · 1 comment

Comments

Projects
None yet
2 participants

All options, except id and name, provided to boolean input is also passed to the label input. For some options, it can cause problems, i.e. tabindex. Both input and label elements get the tabindex and become focusable. User must hit tab two times in order to switch to the next input and nothing happens when they hit enter while the label is focused.

Example:

f.input :confirm, as: boolean, input_html: {tabindex: 2}

results in

<li id="article_confirm_input" class="boolean input optional">
    <input type="hidden" value="0" name="article[confirm]">
    <label tabindex="1" for="article_confirm" class="">
        <input type="checkbox" value="1" tabindex="1" name="article[confirm]" id="article_confirm">
        Confirm
    </label>
</li>

I believe there was a label_html option, which can be used, but it seems to be removed. I don't know the reason but it would be nice to have the possibility to specify label and input options independently. Or maybe tabindex can be removed from the options which are passed to the label, but i don't think it's the right way.

Owner

justinfrench commented Jun 15, 2012

:input_html options should not be applied to labels, so this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment