0

I have a lightbox on my main page that is displayed automatically when the user logs in for the first time, but when the page is loaded a weird javascript error appears in the console which makes that everything related to Primefaces stop working. This is the code of my lightbox:

<p:lightBox styleClass="imagebox" id="lightbox1" visible="true" 
            rendered="#{dashboardBean.firstTimeLoggedIn}" widgetVar="lightbox1"
            onHide="hideInstructions()">
            <h:outputLink 
                value="#{request.contextPath}/resources/images/instructions/instructions-1.gif"
                title="Step 1"/>           

            <h:outputLink
                value="#{request.contextPath}/resources/images/instructions/instructions-2.gif"
                title="Step 2" />            
            <h:outputLink
                value="#{request.contextPath}/resources/images/instructions/instructions-3.gif"
                title="Step 3" />            
</p:lightBox>
        <h:form  rendered="#{dashboardBean.firstTimeLoggedIn}">
            <p:remoteCommand name="hideInstructions"
                action="#{sessionBean.hideInstructions}" />
        </h:form>

And this is the first error that appears in the console of chrome:

First Error

After that if i click in any primefaces button, link, etc.. It just doesn't work

Community
  • 1
  • 1
raven
  • 2,381
  • 2
  • 20
  • 44
  • Are you manually importing a separate jQuery library? Possible duplicate here: http://stackoverflow.com/q/16166039 – BalusC Apr 26 '16 at 20:23
  • @BalusC No, bootstrap.js is the only third party library I'm including. – raven Apr 26 '16 at 20:45

1 Answers1

2

It turned out that it was a bug of the p:lightbox. The error was coming from this file in the line 274, because e.originalEvent was undefined:

 if(e.originalEvent.touches) {
                pageX = e.originalEvent.touches[0].pageX;
                pageY = e.originalEvent.touches[0].pageY;
   } else {
                pageX = e.pageX;
                pageY = e.pageY;
  }

The bug was fixed in this commit

The fix was to add a validation to the first line:

if(e.originalEvent && e.originalEvent.touches) 
raven
  • 2,381
  • 2
  • 20
  • 44