@@ -1171,6 +1171,58 @@ if (typeof module !== 'undefined' && module.exports) {
11711171 }
11721172} ( ) ) ;
11731173
1174+ /**
1175+ * Shared-row label height equaliser.
1176+ *
1177+ * When two (or more) fields share a Bootstrap row (half-width or
1178+ * third/fourth-width layout), a label that wraps onto a second line makes
1179+ * the inputs in that row appear misaligned. This IIFE walks every `.row`
1180+ * that contains multiple `.field-wrapper` columns and sets `min-height` on
1181+ * each label to match the tallest one in the row, so all inputs start at
1182+ * the same vertical position.
1183+ *
1184+ * It runs once after DOMContentLoaded and again on window resize
1185+ * (debounced) so the result stays correct across viewport sizes.
1186+ */
1187+ ( function ( ) {
1188+ function equalizeRowLabelHeights ( ) {
1189+ document . querySelectorAll ( '.row' ) . forEach ( function ( row ) {
1190+ // Collect the first <label> from each direct field-wrapper column.
1191+ var labels = [ ] ;
1192+ row . querySelectorAll ( ':scope > [class*="col-"] > .field-wrapper label' ) . forEach ( function ( lbl ) {
1193+ // Only take the first label per wrapper (ignore nested radio/checkbox labels).
1194+ var wrapper = lbl . closest ( '.field-wrapper' ) ;
1195+ if ( wrapper && wrapper . parentElement . parentElement === row ) {
1196+ if ( ! labels . find ( function ( l ) { return l . closest ( '.field-wrapper' ) === wrapper ; } ) ) {
1197+ labels . push ( lbl ) ;
1198+ }
1199+ }
1200+ } ) ;
1201+
1202+ // Reset before measuring so a shrink is reflected correctly.
1203+ labels . forEach ( function ( lbl ) { lbl . style . minHeight = '' ; } ) ;
1204+
1205+ if ( labels . length < 2 ) return ;
1206+
1207+ var maxH = 0 ;
1208+ labels . forEach ( function ( lbl ) { maxH = Math . max ( maxH , lbl . offsetHeight ) ; } ) ;
1209+
1210+ if ( maxH > 0 ) {
1211+ labels . forEach ( function ( lbl ) { lbl . style . minHeight = maxH + 'px' ; } ) ;
1212+ }
1213+ } ) ;
1214+ }
1215+
1216+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
1217+ equalizeRowLabelHeights ( ) ;
1218+ var _resizeTimer ;
1219+ window . addEventListener ( 'resize' , function ( ) {
1220+ clearTimeout ( _resizeTimer ) ;
1221+ _resizeTimer = setTimeout ( equalizeRowLabelHeights , 120 ) ;
1222+ } ) ;
1223+ } ) ;
1224+ } ( ) ) ;
1225+
11741226/**
11751227 * Currency field enhancement.
11761228 *
0 commit comments