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

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

From: manfred riem <manfred.riem_at_oracle.com>
Date: Tue, 14 Apr 2015 14:42:49 -0500

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