Fixed street.0 field validation bug in Checkout #6397
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This might apply to other situations similar to this, where multiline control is being used. Suggesting to check the whole codebase for similar issue.
Explanation of the problem
In checkout shipping address entry (customer + guest), when a validation error occurs, the first "street" field is not properly marked with "red" colour. This appears to be due the fact that appropriate classes are not being applied.
See:
The problem originates from how the field config is being constructed.
it appears to be taking place in Magento/Checkout/Block/Checkout/AttributeMerger.php
Observe the line 275
'additionalClasses' => $isFirstLine ? : 'additional'
Apparently the additionalClasses value is always set to some value, however in case of field "street.0" we need to "inherit" this value from base config.
The PR here will take care of this. By only setting the value in case it needs to be set to 'additional', otherwise it is not touching it at all.