With the new ::details-content pseudo-element, we no longer need hacks to force <details> blocks open in print. We can simply reveal the hidden content using CSS
@media print {
::details-content {
content-visibility: visible;
height: auto !important;
}
}