What happened?
Description
For compound fields such as the lat/long field in addresses, the error summary doesn't link to the field when those fields are required but left empty.
The fields are also missing the error styling and messaging.
We discovered this when adding our own compound fields using a fieldset. It would be nice if BaseNativeField could handle errors in this situation nicer overall i.e. error summary and individual error styling on fields. The .input.errors > .text selector that applies the border doesn't work if you have a set of fields wrapped in a container div.
Note: We are using BaseNative field with useFieldset, true.
protected function inputHtml(?ElementInterface $element = null, bool $static = false): ?string
{
$output = [];
$output[] = Html::beginTag('div', ['class' => 'flex']);
$output[] = Cp::textFieldHtml([]);
$output[] = Cp::selectFieldHtml([]);
$output[] = Html::endTag('div');
return implode("\n", $output);
}
Steps to reproduce
- Add the lat/long fields to the address element and make required.
- From the user edit page add a new address, leave the lat/long fields empty and save.
- Click the error links in the summary.
Expected behavior
Focus is set to the field when clicking the link.
Actual behavior
Focus isn't set.
Craft CMS version
5.5.3
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
What happened?
Description
For compound fields such as the lat/long field in addresses, the error summary doesn't link to the field when those fields are required but left empty.
The fields are also missing the error styling and messaging.
We discovered this when adding our own compound fields using a fieldset. It would be nice if
BaseNativeFieldcould handle errors in this situation nicer overall i.e. error summary and individual error styling on fields. The.input.errors > .textselector that applies the border doesn't work if you have a set of fields wrapped in a container div.Note: We are using BaseNative field with
useFieldset, true.Steps to reproduce
Expected behavior
Focus is set to the field when clicking the link.
Actual behavior
Focus isn't set.
Craft CMS version
5.5.3
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions