const valueBlock = document.getElementById("value-expanded"); document.querySelector('.value-block').addEventListener('toggle', function() { if (this.open) { // Code to execute when the details are opened valueBlock.scrollIntoView({ behavior: "smooth" }); } });