fix: #3637676 Do not validate international telephone elements hidden by #states

Skips the submit validation of an international telephone element that is hidden by #states, and clears its value. Hidden by #states means: the element or one of its containers has data-drupal-states, and the wrapper that states.js toggles is display: none. A plain :visible check is not enough, because it would also clear a number on an inactive card.

Tested on a clean Drupal 11.4.12 with Webform 6.3.1:

case before after
visible, invalid number blocked, error shown same
hidden, invalid value, #states_clear off blocked, no error visible submitted
hidden, value set by a script blocked, no error visible submitted
#states on a container blocked, no error visible submitted
valid number on card 1, submit from card 2 number saved number saved

AI-Generated: Yes (Claude Code was used to help draft this change and this description. I reviewed it.)

Merge request reports

Loading
Loading