Skip to content
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

Form group has unnecessary float? #475

Closed
andysellick opened this issue May 31, 2017 · 6 comments
Closed

Form group has unnecessary float? #475

andysellick opened this issue May 31, 2017 · 6 comments

Comments

@andysellick
Copy link

.form-group .panel-border-narrow {

The .form-group class has float:left, width:100% on it, which is causing an issue in the Child Benefit Tax Calculator (we're currently converting it to use Elements). We have a .form-group element immediately followed by another div, which has an id on it used by a jump link in the event of an error condition. Since the .form-group element isn't clearfixed, the next div renders part way through it, rather than after it, so the jump link doesn't appear to quite go to the right position on the page.

Removing the float and width from .form-group fixes this problem, but I want to check our use of Elements is correct before accusing anyone of an actual bug - if there's a general clearfix class I could just apply that to the .form-group to also solve the problem, or is it that .form-group should always be inside something else?

This isn't live yet so I can't link to it, but here's an annotated screenshot. The dashed red border shows the boundary of the following div, showing that the .form-group above it is floated over it.

screen shot 2017-05-31 at 14 44 44

@selfthinker
Copy link
Contributor

This is a duplicate of #257.

@andysellick
Copy link
Author

Thanks. Looks like there hasn't been any movement on this for a while. Anyone I should chase on this, or is there a workaround? e.g. generic clearfix class?

@gemmaleigh
Copy link
Contributor

Hi @andysellick @selfthinker,

.form-group uses the %contain-floats placeholder from the govuk_frontend_toolkit: https://github.com/alphagov/govuk_elements/blob/master/assets/sass/elements/_forms.scss#L56

https://github.com/alphagov/govuk_frontend_toolkit/blob/e03e7f56e1b70194310ee970a3ccf00bd9376b36/stylesheets/_shims.scss#L38

That should be clearing each .form-group wrapper.

I'm the person you should chase, sorry for the slow reply. Feel free to open a PR to fix!

@selfthinker
Copy link
Contributor

The %contain-floats would only clear floats within the wrapper, not when the same wrapper itself is floating.

@andysellick
Copy link
Author

Thanks both. I've managed to solve the problem (accidentally) by reworking the markup, but if I have time will do a PR.

@andysellick
Copy link
Author

Looks like this has been fixed... #487 ...thanks @gemmaleigh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants