jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [jsr372-experts mirror] Re: Handling focus after an Ajax update (PROPOSAL)

From: Kito Mann <kito.mann_at_virtua.com>
Date: Wed, 15 Apr 2015 10:37:54 -0400

On Wed, Apr 15, 2015 at 7:28 AM, Josh Juneau <juneau001_at_gmail.com> wrote:

> Hi Everyone,
>
> I like the ideas that have been introduced by Manfred and Kito. I do
> wonder if it makes sense to add a new global configuration that would allow
> the user to apply the functionality of the f:focus tag to all ajax-enabled
> components within an application. To me, it seems that such a
> configuration may make sense in ajax-heavy applications, in cases where
> embedding an f:focus inside of each ajax-enabled component may become
> cumbersome. In most scenarios, I would guess that the user expects to
> come back to the next component in the form after an ajax call...especially
> when tabbing. Just a thought...
>

Agreed. Manfred and I discussed this as well.

>
> With regards to the end user not reading the documentation, I don't think
> that the onus is on the spec to name a component differently just because
> other libraries use similar names for different functionality. It seems
> that f:focus would make sense in this case, and the most useful way to curb
> the issue would be describing the functionality of the f:focus in the
> javadoc. In most cases where an IDE is used, the Javadoc will display when
> the tag is being typed anyways.
>
> Thanks
>
> Josh Juneau
> juneau001_at_gmail.com
> http://jj-blogger.blogspot.com
> https://www.apress.com/index.php/author/author/view/id/1866
>
>
> On Tue, Apr 14, 2015 at 3:16 PM, Bauke Scholtz <balusc_at_gmail.com> wrote:
>
>> Hi,
>>
>> Looks okay. I'd however as a dumb enduser without reading the
>> documentation intuitively expect that the <f:focus> also runs when loading
>> the page when being placed outside an input component, exactly like as
>> PrimeFaces <p:focus> does (
>> http://www.primefaces.org/showcase/ui/misc/focus.xhtml). Perhaps this
>> could be added to the feature set.
>>
>> And, make sure that it also works as expected when used in
>> UIData/UIRepeat components.
>>
>> Cheers, B
>>
>>
>>
>> On Tue, Apr 14, 2015 at 9:42 PM, manfred riem <manfred.riem_at_oracle.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> After discussing this on the phone with Kito, I think we have a proposal
>>> / sketch for getting this done.
>>>
>>> 1. Introduce a new ClientBehavior, FocusBehavior with its
>>> FocusBehaviorRenderer
>>> 2. Introduce its backing tag, f:focus
>>>
>>> The FocusBehavior will encapsulate the JavaScript portion that is
>>> necessary to determine the element that has focus, and take the appropriate
>>> action to make sure once the f:ajax call returns to set the focus to the
>>> element that needs focus.
>>>
>>> For the f:focus tag we think one could either specify it without a
>>> clientId which would imply it would set focus to the element it was
>>> embedded in, or with a clientId which would set the focus to the element
>>> with the given clientId.
>>>
>>> E.g
>>>
>>> <h:inputText ...>
>>> <f:focus clientId="otherElement"/>
>>> <f:ajax/>
>>> </h:inputText>
>>>
>>> Kito has kindly agreed to do the prototyping for this so let us know
>>> what you think.
>>>
>>> Thanks!
>>>
>>> Kind regards,
>>> Manfred Riem
>>>
>>>
>>
>