Support Article

CPM portal steals focus from third party browser in Pega 7.1.7

SA-14954

Summary



A Customer Process Manager (CPM) user portal is launched in a new browser window, on click of a button that is present in a third party browser based application window. When the CPM portal window completes loading, it steals focus from the third party application browser window.


Error Messages



Not Applicable.


Steps to Reproduce



Create and run a sample HTML page as below, to mimic a third party browser based non-Pega application:

<html> 
<script> 
function abc(){ 
a = window.open("http://<host name>:<port number>/prweb/PRServlet"); 

</script> 
<body> 
<input type="button" id="btn" value="OpenPega" onClick="javascript:abc();" /> 
</body> 
</html>

2. Click "OpenPega" button. It opens the PRPC login page in a new window.
3. Click New>Phone call in the CPM portal window.
4. While the phone call tab is being loaded, quickly click on the parent window (so that CPM portal window goes behind the parent). 
5. Once the phone call tab is loaded , that CPM portal window steals focus and stays on the top of parent window.

Root Cause



The reported use case works as designed per Pega 7 functionality. CPM portal are designed to steal focus to support accessibility.

Resolution



Perform the following local-change if you do not want Pega portal to steal focus from your parent application window : 

1. Save-As UserWorkForm HTML fragment into your application layer
2. Copy the below code into it :
<script>
pega.u.d.initFocusOnFirstInput = function(){}
</script>

Suggest Edit

Published January 31, 2016 - Updated October 8, 2020

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.