views:

38

answers:

3

The site is here: http://tinyurl.com/2wj8qb4

I have opt to using the radiobutton's labels as customized buttons for them. This means the radio inputs themselves are display:none. Because of this, the browsers don't tab stop at the radio labels, but I want them to.

I tried forcing a tabindex to them, but no cigar.

I have came up with just putting a pointless checkbox right before the labels, and set it to width: 1px; and height 1px; which seems to only really work on chrome & safari.

So do you have any other ideas for forcing a tab stop at those locations without showing an element?

Edit:

Just incase someone else comes by this, this is how I was able to insert small checkboxes into chrome & safari using JQuery:

if ($.browser.safari) {
    $("label[for='Unlimited']").parent().after('<input style="height:1px; width:1px;" type="checkbox">');
    $("label[for='cash']").parent().after('<input style="height:1px; width:1px;" type="checkbox">');
    $("label[for='Length12']").parent().after('<input style="height:1px; width:1px;" type="checkbox">');
}

Note: $.browser.webkit was not becoming true...so I had to use safari

A: 

Discard the radio-buttons and instead; keep some hidden fields in your code, in which you store the selected value of your UI components.

roosteronacid
This would require rewriting everything that is already setup, I am looking for a more simple solution.The reason I did radio buttons to avoid writing code to require an input of some sort...etc.
BHare
Sometimes you run into situations where you need to refactor a bit... And as far as I can see, all you need is a JavaScript click-event on each of your tabs, which takes the ID of the currently selected tab and puts it in a hidden field. Then it's just a matter of changing your server-side code to use values from the hidden fields instead of the radio-buttons.
roosteronacid
A: 

Keep the radio input hidden, but set tabindex="0" on the <label> element of reach radio input.

(A tab index of 0 keeps the element in tab flow with other elements with an unspecified tab index which are still tabbable.)

strager
This does not work, even putting tabindex="0" on the labels of a hidden radio input seem to be skipped. Atleast in chrome.
BHare
@Brian, Seems I was wrong; `tabindex` non non-form elements is an extension in some browsers (e.g. IE and Firefox, which is what I tested with).
strager
BHare
Check my edit to see the example on how I used JQuery to insert small checkboxes
BHare
A: 

If you separate the label from any field and set a tabIndex you can tab to it and capture mouse and key events. It seems more sensible to use buttons or inputs with type="button", but suit yourself.

<form>
<fieldset>
<input value="today">
<label tabIndex="0" onfocus="alert('label');">Label 1</label>
</fieldset>
</form>
kennebec