PDA

View Full Version : Focus management on Field



cravemusic
26 Sep 2008, 8:51 AM
It would be useful to have the focus capabilities of the Field class extended. I propose the following:

boolean isFocused(): return true if this field has focus

void blur(): Blur a field without placing focus on another field. If this is called on a field that does not have focus, it's a no op.

cravemusic
6 Oct 2008, 12:57 PM
Here are a few other additions I would use if they existed:

void allowFocus(boolean): Allow an instance of the Field class to not gain focus.

Reason: Currently, if you have an AdapterField between two TextFields, the browser attempts to focus the AdapterField, even if the contents of such a field cannot be focused. I'd rather have a better keyboard nav experience by allowing my tabbing to skip over fields I designate as non-focusable.

void setFocusIndex(int): Set the explicit order in which fields receive focus when pressing the tab key. In HTML, this can be represented on <input> as the tabindex attribute.

cravemusic
30 Oct 2008, 10:36 AM
I just noticed that you can blur a field through its El representation, so that one can be crossed off the list. But, the others would still be great to have.

jpnet
6 Nov 2008, 1:46 PM
void setFocusIndex(int): Set the explicit order in which fields receive focus when pressing the tab key. In HTML, this can be represented on <input> as the tabindex attribute.

Check out setTabIndex method.

-JP

cravemusic
6 Nov 2008, 1:49 PM
JP, thanks for pointing out that method. I had not looked for this functionality in the El class when I originally wrote this.