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

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

From: Bauke Scholtz <balusc_at_gmail.com>
Date: Tue, 14 Apr 2015 22:16:53 +0200

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
>
>