Question
ScotiaBank
CA
Last activity: 12 May 2021 9:51 EDT
When clicking a vertical tab in Cosmos, tab content is hidden beneath assignment processing
Hi Team,
In Cosmos 8.4.3 when we are processing an assignment with a long form, if I click a vertical tab in the case summary panel, it is not visible that anything happened because the tab content is out of view. How can I automatically scroll down the page to see the tab content when a vertical tab is clicked?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 25 Jan 2021 11:20 EST
Pegasystems Inc.
US
@ReshmaK3 I updated the code snippet so that it works with a screenflow - As indicated in my reply, the code highlighted in blue will likely need to be updated to meet your requirements.
Instead of updating the Review or the TreeNavigation7 harness at Work-, I have updated my reply to add the function directly into the UserWorkform.
Pegasystems Inc.
IN
Hello @ReshmaK3,
I am really not clear with the usecase. Can you attach proper screenprint of usecase and issue. The two PNG attached does not show anything.
If you need a scrollbar to scroll down the page, add "overflow-y:scroll !important;" to the DOM for the particular element. You need to inspect using browser debugger and check which element would need the scroll.
If this works, then using the ID or Class name add the same style to UserWorkForm.
Regards,
Tashika
ScotiaBank
CA
@shret the issue is with the focus, the section is not getting focused and we need to scroll down and see the section.
Please refer the SR INC-158509 for further details.
Pegasystems Inc.
IN
Hello @ReshmaK3,
I checked the INC and the engineer working on it already commented that the issue is a BUG in platform.This would be addressed in 8.4.5 patch release.
Regards,
Tashika
Updated: 11 Feb 2022 14:53 EST
Pegasystems Inc.
US
@ReshmaK3 Cosmos Rules 1.0 will by default always scroll to the top of the content every time a vertical tab is clicked - this was done so that the content of the tab is visible instead of keeping the current scrolling position of the old tab.
Note that this is how Cosmos Rules behaves by default and this is not a bug - changing the scrolling position when clicking tab will have other unintended effects for the users. If a user is entering a complex form, he might not want to see this auto-scrolling behavior.
Here is a demo of the behavior you want to achieve
insert the following code in the UserWorkform HTML fragment
@ReshmaK3 Cosmos Rules 1.0 will by default always scroll to the top of the content every time a vertical tab is clicked - this was done so that the content of the tab is visible instead of keeping the current scrolling position of the old tab.
Note that this is how Cosmos Rules behaves by default and this is not a bug - changing the scrolling position when clicking tab will have other unintended effects for the users. If a user is entering a complex form, he might not want to see this auto-scrolling behavior.
Here is a demo of the behavior you want to achieve
insert the following code in the UserWorkform HTML fragment
<script>
pega.namespace("pega.ui.templatenav");
pega.ui.templatenav.toggleLayoutGroupTab = function(sectionId, index) {
var headerNode;
if (index !== undefined) {
headerNode = document.querySelector(".template-nav-content > .layout[data-lg-child-id='" + index +
"'] > .header");
} else {
var els = document.querySelectorAll(".template-nav-content > .layout > .header");
for (var i = 0; i < els.length; i++) {
if (els[i].textContent.trim() === sectionId) {
$(els[i]).click();
break;
}
}
}
if (headerNode && headerNode.getAttribute("aria-selected") !== "true") {
var workAreaScrollWrapper = headerNode.closest(".workarea-view-scroll-wrapper");
if (workAreaScrollWrapper.closest(".workarea-flex") === null) {
workAreaScrollWrapper = workAreaScrollWrapper.closest(".screen-layout-region-main");
}
if (workAreaScrollWrapper) {
var bbox = headerNode.parentNode.parentNode.getBoundingClientRect();
if (bbox.top + 400 > workAreaScrollWrapper.clientHeight) {
setTimeout(function() {
var bbox1 = document.querySelector(".template-nav-content").getBoundingClientRect();
workAreaScrollWrapper.scrollTo({
top: (workAreaScrollWrapper.scrollHeight - bbox1.height - 400),
behavior: 'smooth'
});
}, 200);
}
}
$(headerNode).click();
}
};
</script>
this JS function will override the core function called toggleLayoutGroupTab that is called when toggling vertical tabs. This code is present in the JS file 'pzpega-templatenav'. Most of the code must stay as is - the customization can be done in the lines inside the setTimeout function to change the position of the scroll
In this code, if the bottom position of the tab is 400px above the viewport height, the scroll will not be triggered - otherwise the code will scroll to this position.
The demo of the changes was done in 8.4.4 using Theme-Cosmos 01.01. The change was tested for screenflows and regular flow. It works with the Review or the TreeNavigation7 harness as a main page harness.
This function might have to change in Theme-Cosmos 2.0 and some of the changes done in the file 'pzpega-templatenav' will need to be re-applied when upgrading to Cosmos 2.0
Note that this code is delivered 'as is' - you are free to use it in your application but if you do, you need to understand what the code is doing and be able to maintain it - if you do not understand the code above, you should use the OOB functionality provided in Theme-Cosmos.
-
Marissa Rogers
ScotiaBank
CA
@RichardMarsot I tried adding it, But it is not working for me
ScotiaBank
CA
@RichardMarsot It is working fine for Review Harness
Looks like i need to add the js file for TreeNavigation7 Harness as well.
Thanks for the code.
ScotiaBank
CA
@RichardMarsot I added the js file is TreeNavigation7 Harness but it is not working there.
Please advice if we are missing anything
Accepted Solution
Updated: 25 Jan 2021 11:20 EST
Pegasystems Inc.
US
@ReshmaK3 I updated the code snippet so that it works with a screenflow - As indicated in my reply, the code highlighted in blue will likely need to be updated to meet your requirements.
Instead of updating the Review or the TreeNavigation7 harness at Work-, I have updated my reply to add the function directly into the UserWorkform.
ScotiaBank
CA
@RichardMarsot Thank you so much. it is working fine now for all the harness
CIBC
CA
@RichardMarsot hello Richard, we are using Theme-Cosmos:02-01 and when included the above snippet, it scrolling but the behaviour is very inconsisent. Will the above code works for 02-01. If not, can you provide the code supporing 02-01. we have portal header of 80px height.
here is the screenshot.
Pegasystems Inc.
US
@Venu gopala krishna the snippet should work with Cosmos Theme 1.0 and 2.0 - the issue is due to the portal header - this is not a support out-of-the-box configuration in Cosmos and can only be achieved by doing some customization. in the code snippet, try to add the height of your header to bbox.y when doing the scrollTo