CSS:
input[type="radio"] {
scroll-margin-top: 10px;
}
JS:
const form = document.querySelector('form');
form.addEventListener('submit', (event) => {
const firstCheckedElement = form.querySelector('input[type="radio"]:not(:checked)');
if (firstCheckedElement !== null) {
event.preventDefault();
firstCheckedElement.scrollIntoView({
behavior: 'smooth',
});
}
});