PrimeFaces.scrollTo
See original GitHub issueDescribe the bug
After one of the latest Firefox and Chrome updates
PrimeFaces.scrollTo() in not scrolling anymore
Reproducer
<p:panel id="data" style="height: 1000px;">
Hello
</p:panel>
<!-- works -->
<a href="#" onclick="window.scrollTo(0,0)" >Scroll JS</a>
<!-- does nothing -->
<a href="#" onclick="PrimeFaces.scrollTo('data');" >Scroll JS PrimeFaces</a>
<!-- does nothing -->
<h:form id="test">
<p:commandButton id="scroll" action="#{testAction.scrollTo('data')}" value="Scroll Ajax PrimeFaces" />
</h:form>
@Named
@ViewScoped
public class TestAction implements Serializable {
private static final long serialVersionUID = 819314778934153831L;
public void scrollTo(String id) {
PrimeFaces.current().scrollTo(id);
}
}
Expected behavior
scroll to “data” p:panel
PrimeFaces edition
Elite
PrimeFaces version
8.0.17
Theme
No response
JSF implementation
Mojarra
JSF version
2.2.20
Browser(s)
Chrome 102 | Firefox 100 - Fedora 35 | Windows 11
Issue Analytics
- State:
- Created a year ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
ScrollTo a Component After Ajax Update - PrimeFaces
When the panel component is updated, PrimeFaces will scroll to the component with a smooth animation. Check out the live demo at PrimeFaces...
Read more >Primefaces RequestContext scrollTo does not work
Primefaces v3.5. Trying to use RequestContext.getContext().scrollTo("") to scroll to my form programmatically at the end of an ajax request.
Read more >RequestContext (primefaces 6.2 API) - javadoc.io
Use PrimeFaces.scrollTo(java.lang.String) instead. static void, setCurrentInstance(RequestContext context, javax.faces.context.FacesContext facesContext).
Read more >ScrollTop | PrimeFaces JavaScript API Docs
Class ScrollTop<TCfg>. PrimeFaces ScrollTop Widget. ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page ......
Read more >PrimeFaces.executeScript - Java - Tabnine
public void scrollTo(String clientId) { executeScript("PrimeFaces.scrollTo('" + clientId + "');");
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PF code is doing this which is what a lot of users in that Stack Overflow recommend to do…
tested, it works…
the problem is css smooth scroll
If you enable it inside test.css
PrimeFaces.scrollTo does not work anymore
I don’t know why but before Chrome 102 or 101 and FF 100 or 99 it was working for sure, because i use this technique since 2 years