question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When nesting <Select multiple inline> inside <FormField>, options have significant whitespace issues

See original GitHub issue

Expected Behavior

A <Select multiple inline> component should render correctly when used inside a <FormField> component.

Actual Behavior

The <Select> options display with what looks like a huge amount of padding above each option (see screenshot / codepen).

What I think is actually happening is something like this:

  1. Using <Select multiple inline> causes the options to be rendered using <Checkbox> internally.
  2. The <Checkbox> component uses a zero-height, zero-width, zero-opacity <input type="checkbox">, and renders a nicer-looking checkbox with SVG. Essentially, the original input is hidden without explicitly using display: none.
  3. Something in the <FormField> styles (probably this line) is explicitly setting a height for the <input>, which is intended to be “hidden”, breaking the layout of the <Checkbox>.

URL, screen shot, or Codepen exhibiting the issue

Codepen: https://codepen.io/ezzatron/pen/WXGoJe

Screenshot:

screen shot 2017-11-07 at 5 23 56 pm

Steps to Reproduce

  1. Nest a <Select inline multiple> with some options inside a <FormField>
  2. Observe whitespace issues

Your Environment

  • Grommet version: 1.8.3
  • Browser Name and version: Chrome 61.0.3163.100, also Firefox
  • Operating System and version (desktop or mobile): macOS Sierra

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ezzatroncommented, Nov 7, 2017

Thanks for the fix!

1reaction
dgennettencommented, Nov 7, 2017

A temporary workaround: wrap the offending <Select> in a <Box>

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I evenly add space between a label and the input field ...
First of all, use label instead of span . It's meant to be paired with inputs and preserves some additional functionality (clicking label ......
Read more >
How whitespace is handled by HTML, CSS, and in the DOM
If there is formatting whitespace between adjacent inline elements, this will result in space in the layout, just like the spaces between words ......
Read more >
Setting the height of react-select · Issue #1322 - GitHub
I am having a hard time setting the height of react-select. ... Look for a deeply nested one that has a div inside...
Read more >
Forms in HTML documents - W3C
An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and...
Read more >
How to Customize the Style of Individual Form Fields - WPForms
In this tutorial, we'll provide a list of nearly any selector you might need to style individual fields on your forms. Note: This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found