-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MOJ - Add another functionality doesn't work when input wrapper for suffix is in use #185
Labels
bug
A task that fixes something that isn't working
Comments
gregtyler
added a commit
that referenced
this issue
Jun 25, 2021
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
gregtyler
added a commit
that referenced
this issue
Jun 25, 2021
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
gregtyler
added a commit
that referenced
this issue
Jun 28, 2021
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Description
Currently we are looking at the moj-add-another (https://moj-design-system.herokuapp.com/components/add-another) design pattern and we have managed to get it working fine. However, when we wrap our input in a gov-uk wrapper (suffix) the add another button decides it no longer wants to work, interestingly it actually works when javascript is turned off.
Steps to Reproduce
https://github.com/dwp/atw-payment-claims-service - link to prototype code in github. Specific folder structure is alpha>support-worker>hours-for-day.
Expected behaviour: [We expect that the add another functionality should still work when a govuk - suffix is added to the pattern for one of the fields as it would without]
Actual behaviour: [the grey add another button now is unresponsive and doesn't auto generate when the wrapper is in the code.]
Reproduces how often: [100%]
Versions
You can get this information from the CHANGELOG. Also, please include details of the browser and OS version you're running.
Additional Information
Apologies if this is not detailed enough, this is my first time leaving a bug issue on github and i'm a UX designer not a Developer, if you require any more information feel free to reach out to me on - [email protected]
The text was updated successfully, but these errors were encountered: