Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(add-another): find labels of affixed text inputs
When a text input has affixes, it is wrapped in a `.govuk-input__wrapper` div, meaning its label is no longer adjacent. This caused the Add anotehr component to fail, because it couldn't find the input's label and update its for/id link. I've added a new strategy for finding the label: if it's not the parent or adjacent, then JavaScript identifies it by searching for a label whose `for` attribute is the ID of the original input. This should not introduce any regressions because the previous strategies are still in place and prioritised: the new strategy will only be used if nothing was found, which would have previously resulted in the application crashing. fixes #185
- Loading branch information