Expand my Community achievements bar.

SOLVED

Browsing and previewing assets always brigs you back to the top of the list

Avatar

Level 3

Hello Team,

 

6.5 on-site version.

Assume you have a folder with 300 assets in it. You scroll down to the last 50 assets to preview, make corrections in metadata, etc. Each time you open and close the asset you are back at the top of the list of that folder. Then each time you have to scroll down through pages to get to where you last were... Now imagine you have a folder with 1000+ assets and you have to preview them... This is rather frustrating that AEM does not remember or hold last position and each time takes you back to the top of the list. It also takes time...

Yes, I am aware I can open each image in a new tab each time, but sometimes we forget as it is not the common practice of how we open images when browsing... 

Is there a way to browse through the assets and not have to start from the top each time I open and close the image? I have worked with a few DAMs in the past, and non had this kind of "flaw".

 

Many thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,


Unfortunately, there is no easy way to accomplish that because the items you see on the screen are rendered server-side. This means that the page will fully reload when you navigate back from the details page, making it difficult to return to the previous scroll position. However, I think opening the link in a new tab could be a viable solution. You could update the out-of-the-box behavior to force the items to always open in a new tab, which would help prevent user errors.

 

A simple JS like below should work fine, you would need to run this below JS when the page loads:

const links = document.querySelectorAll('.dam-test-collection-item-name .foundation-layout-table-cellwrapper');

    // Loop through each link and add the event listener
    links.forEach(link => {
        link.addEventListener('click', function(event) {
            event.preventDefault(); // Prevent the default anchor behavior
            event.stopPropagation(); // Stop other event handlers from running
            window.open(this.href, '_blank'); // Open the link in a new tab
        });
    });

 

Hope this helps



Esteban Bustamante

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,


Unfortunately, there is no easy way to accomplish that because the items you see on the screen are rendered server-side. This means that the page will fully reload when you navigate back from the details page, making it difficult to return to the previous scroll position. However, I think opening the link in a new tab could be a viable solution. You could update the out-of-the-box behavior to force the items to always open in a new tab, which would help prevent user errors.

 

A simple JS like below should work fine, you would need to run this below JS when the page loads:

const links = document.querySelectorAll('.dam-test-collection-item-name .foundation-layout-table-cellwrapper');

    // Loop through each link and add the event listener
    links.forEach(link => {
        link.addEventListener('click', function(event) {
            event.preventDefault(); // Prevent the default anchor behavior
            event.stopPropagation(); // Stop other event handlers from running
            window.open(this.href, '_blank'); // Open the link in a new tab
        });
    });

 

Hope this helps



Esteban Bustamante

Avatar

Level 3

Hi @EstebanBustamante ,

 

Thanks for sharing the workaround code. I will share it with the Dev (who by this time probably already pronounces my name as a curse :D).

Meanwhile I will relearn to open images in new tabs. 

 

Many thanks