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

PF4 Forms (horizontal) alignment of label to checkbox #2660

Closed
jgiardino opened this issue Aug 7, 2019 · 11 comments
Closed

PF4 Forms (horizontal) alignment of label to checkbox #2660

jgiardino opened this issue Aug 7, 2019 · 11 comments
Labels
PF4 React issues for the PF4 core effort

Comments

@jgiardino
Copy link
Collaborator

When creating a form that includes a label for a group of checkboxes, the label text and the checkbox text are not aligned. Also, an example of this layout would be nice to see so that we know that we're using the component correctly.

@jkozol
Copy link

jkozol commented Aug 7, 2019

This is an example of a form that has the misalignment:

<Form isHorizontal>
  <FormGroup label="Your Name" fieldId="horizontal-form-name">
    <Text>John Smith</Text>
  </FormGroup>
  <FormGroup label="Your experience" fieldId="horizontal-form-exp">
    <Checkbox label="Follow up via email" id="alt-form-checkbox-1" name="alt-form-checkbox-1" />
  </FormGroup>
</Form>

@rachael-phillips
Copy link
Contributor

Hi @jgiardino and @jkozol is this issue currently blocking you?

@rachael-phillips rachael-phillips added PF4 React issues for the PF4 core effort p1 labels Aug 19, 2019
@rachael-phillips
Copy link
Contributor

@mcoker and @jschuler is this a core issue?

@jschuler
Copy link
Collaborator

@mcoker would you have an example of how a simple label / value form group should look?

@mcoker
Copy link
Contributor

mcoker commented Aug 19, 2019

@jschuler @jessiehuff you can see an example of checkboxes in a horizontal form here - https://www.patternfly.org/v4/documentation/core/demos/basicforms

@jgiardino
Copy link
Collaborator Author

@mcoker That example actually does not have a label included. When I highlight the .pf-c-form__horizontal-group element, I see the grid for that group does not include a label.

image

If I paste a <label> into the pf-c-form-group element, then I see the following alignment between the label and the checkbox label:

image

But related to this pattern, there are a couple of other requirements that would be nice to support:

  • Ability to have more than one checkbox per text label on the left
  • Ability to have more semantic markup, so that the group of checkboxes can be wrapped with a fieldset, with the fieldset labelled by the label on the left.

An issue related to these two requirements already exists in core: patternfly/patternfly#953

@jgiardino
Copy link
Collaborator Author

Hi @jgiardino and @jkozol is this issue currently blocking you?

I don't know that I would consider this blocking us. We can either add custom css as a temporary fix or leave the alignment as is until it is addressed.

@rachael-phillips rachael-phillips added p2 and removed p1 labels Aug 20, 2019
@mcoker
Copy link
Contributor

mcoker commented Aug 20, 2019

@jgiardino ah sorry about that, I didn't see that the Checkbox component contained a label in the code above - I thought we were just adding a label for the checkbox, not a label for the checkbox + label pair.

@rachael-phillips yes this is a core issue. It's an issue with label alignment when there is anything except for a form control element on the right side of the grid. I filed an issue here for the alignment - patternfly/patternfly#2167

@rachael-phillips
Copy link
Contributor

@jkozol do you mind if I close this issue in favor of patternfly/patternfly#2167?

@jkozol
Copy link

jkozol commented Aug 23, 2019

@rachael-phillips I am fine with you closing this in favor of patternfly/patternfly#2167

@rachael-phillips
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PF4 React issues for the PF4 core effort
Projects
None yet
Development

No branches or pull requests

5 participants