question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Core: After updating a component using AJAX in Safari, the current scroll position changes

See original GitHub issue

Test code;

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    	xmlns:p="http://primefaces.org/ui"
    xmlns:h="http://java.sun.com/jsf/html">
  
<h:head>
    <title>Test</title>
</h:head>
<h:body>
    <h:form>
	    <div style="height: 1000px">
	    	<div style="height:400px"></div>   
	    	<div style="height:1800px"> 
		        <h:inputText id="name" value="#{testBean.test}"></h:inputText>
		        <p:selectOneMenu>
		        	<f:selectItems value="#{testBean.values}" />
				<p:ajax listener="#{testBean.test()}" update="@form" />        
			</p:selectOneMenu>
		</div>
	    </div>
    </h:form>
</h:body>
</html>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:47 (47 by maintainers)

github_iconTop GitHub Comments

3reactions
tandraschkocommented, Jan 6, 2021

IMO none of the fixes are cool currently. Merts fix duplicates DOM elements and the scripts finds both. So this doesnt work by design, wether Safari nor other browsers.

Remeber the scroll position and restore it on Safari might be the best currently but i wonder why it doesnt happen in other browsers? Maybe a jquery bug? Maybe other browsers wait to scroll until DOM elements were replaced? Does it work with plain JS replace of the DOM elements instead of jquery methods?

We must find the root problem before applying hacks.

2reactions
tandraschkocommented, Jan 7, 2021

Nice analysis Mert ✌️ We should search the Bug in selectOneMenu, not hack around in Ajax Core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

After a component is updated, on Safari and Firefox (Mac) the ...
After a component is updated, on Safari and Firefox (Mac) the page changes its scroll position · Open the app on Safari or...
Read more >
Angular 5 Scroll to top on every Route click - Stack Overflow
Using viewPortScroller.scrollToPosition([0, 0] didn't always scroll to the top. Changed parameter to [0, -50] and it works every time.
Read more >
jQuery and Ajax Tutorial
AJAX Interface: jQuery provides a simple Ajax interface to send asynchronous HTTP GET/POST requests and process the response. With jQuery, you can write...
Read more >
Document: scroll event - Web APIs - MDN Web Docs - Mozilla
The scroll event fires when the document view has been scrolled. To detect when scrolling has completed, see the Document: scrollend event.
Read more >
fancybox3 · Documentation
Get started with fancybox, probably the world's most popular lightbox script. ... Some functionality (ajax, iframes, etc) will not work when you're opening ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found