自动滚动到JSF验证错误,p:focus和p:selectOneMenu不工作

自动滚动到JSF验证错误,p:focus和p:selectOneMenu不工作,jsf,primefaces,Jsf,Primefaces,我的elem有焦点问题 我使用来关注失败的验证字段。 这是我的xhtml代码的一部分: <h:form> <p:focus/> [Some other panel and inputText] <p:selectOneMenu id="workCategory" value="#{personDto.category}"

我的elem有焦点问题

我使用
来关注失败的验证字段。 这是我的xhtml代码的一部分:

<h:form>
    <p:focus/>

    [Some other panel and inputText]

                <p:selectOneMenu id="workCategory"
                                 value="#{personDto.category}"
                                 filter="true" filterMatchMode="contains"
                                 required="true" style="min-width: 0px !important;">
                    <f:selectItem itemValue="#{null}"
                                  itemLabel="please select something"
                                  noSelectionOption="true" itemDisabled="true"/>
                    <f:selectItems value="#{clientController.categoryList}"
                                   var="category" itemValue="#{category}"
                                   itemLabel="#{category.label}}"/>
                    <p:ajax event="change"
                            listener="#{clientController.doSomeJob(personDto.category)}"
                            partialSubmit="true" process="@this, @(.csrf)"
                            />
                </p:selectOneMenu>
                <p:message for="workCategory" display="text"/>

</h:form>

[其他一些面板和输入文本]
当验证失败时,焦点将放在验证失败的第一个元素上,这意味着页面将滚动到此元素。这适用于我页面的其他元素,如inputText、switchButton……但是它似乎不适用于
,因为当它是第一个未通过验证的元素时,页面不会滚动到它的位置

我检查了当焦点事件被触发时,
是否接收到类
“ui state focus”
。尽管在验证失败时具有“ui状态焦点”,但它不会按预期滚动。 我试图用
替换
。它适用于
,但不适用于


为什么会发生这种情况?我如何解决这个问题?我需要,因为我不能轻易更改为
,因为整个应用程序可能会受到影响

如果删除所有面板和面板组,是否仍会失败?然后请将它们从示例中删除。这是a的步骤之一,请创建一个。另外,请说明您的PF版本并使用最新的PF版本进行测试?我的PrimeFaces版本是5.3.14。当我删除所有包装面板和面板组时,它仍然失败。尝试了6.0或更高版本,6.1-SNAPSHOT?我无法更改版本,因为此应用程序即将投入生产。更改版本可能会影响otger组件。