Scroll group into view when it becomes visible

This article needs work. But here’s some example code of how you can automatically scroll to the group that appears:

Form

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<label>
  Enter some text here, and the form should automatically scroll down to group-1<br>
  [text txt]
</label>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
[group group-1]Group 1[/group]
<script>
  jQuery('form').on('wpcf7cf_show_group', function(e) {
    if (e.target.getAttribute('data-id') === 'group-1') {
      e.target.scrollIntoView();
    }
  });
</script>

Conditions

show [group-1] if [txt] not empty ""

Test the form

Form tester link