Now that I got the test case the solution is obvious. The function that needs to be used in onclick callback should be ice.setFocus instead of ice.applyFocus. This ensures that ice.focus parameter will be changed before the submit is issued (ice.applyFocus runs with a delay).
Setting the focus this way will enable focus retention to send back
<eval>ice.applyFocus('...')</eval>
command to maintain focus on the element with the ID specified in ice.focus parameter. This is a strategy that many of our components and demo apps are using.
The test code just needs to be changed like this:
<h:form id="iceForm">
<icecore:focusManager for="inputOne">
<h:panelGrid columns="2">
<ice:outputText value="Input One:"/>
<ice:inputText id="inputOne" value="#{testBean.inputOne}"/>
<ice:outputText value="Input Two:"/>
<ice:inputText id="inputTwo" value="#{testBean.inputTwo}"/>
<ice:outputText value="Input Three:"/>
<ice:inputText id="inputThree" value="#{testBean.inputThree}"/>
<ice:outputText value="Input Four:"/>
<ice:inputText id="inputFour" value="#{testBean.inputFour}"/>
<ice:commandButton id="clearBtn" value="Clear"
actionListener="#{testBean.clear}"
onclick="ice.setFocus('inputOne');"/>
</h:panelGrid>
</icecore:focusManager>
</h:form>
I've tested this with ICEfaces 4.x as well using the standard JSF components. The same issue is seen here where focus is lost once the update is applied.
I also tested with the <icecore:focusManager/> tag. This didn't change the behavior when having it set for the ID of the first input field: <icecore:focusManager for="inputOne">. With the Showcase demo of this component I can see similar behavior: