Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Make wrapper-element configurable #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

flash1293
Copy link

@flash1293 flash1293 commented Feb 8, 2018

This PR uses a span as the wrapping element instead of a div. This makes it possible to use the component inside of elements which prohibit the usage of block-elements as children like paragraphs.

Example:

<p><Autocomplete {/*...*/} /></p>

Prodcues the error <div> cannot appear as a descendant of <p>. See ... > Autocomplete > div.

Tests are not adjusted, I will add them tomorrow.

@flash1293 flash1293 changed the title use span instead of div for wrapper-element WIP: use span instead of div for wrapper-element Feb 8, 2018
@CMTegner
Copy link
Collaborator

Hi Johannes! I think I'd rather wait for something like #298 instead of changing the root node type, as this will likely cause problems for people who rely on the rapper being a <div>. If you feel like having an attempt at implementing the that suggestion it would be greatly appreciated.

@flash1293
Copy link
Author

flash1293 commented Feb 11, 2018

Fair enough - what about a new prop renderWrapper analogous to renderInput and renderMenu?
It would be a function with the parameters wrapperProps, wrapperStyle, renderedInput and renderedMenu, default is something like

return <div style={{wrapperStyle}} {...wrapperProps}>
{renderedInput}
{renderedMenu}
</div>;

Pros:

Would be happy to adjust the PR if you agree.

@CMTegner
Copy link
Collaborator

Sounds good! I wonder if maybe we should rather pass in renderInput and renderMenu in addition to isOpen, so you have full control over what you want to render.

@flash1293
Copy link
Author

@CMTegner I added the renderWrapper prop. I'm not sure what you mean by full control. With open, renderMenu, renderInput and now renderWrapper, the user should be in complete control of the render-output.

@flash1293 flash1293 changed the title WIP: use span instead of div for wrapper-element Make wrapper-element ocnfigurable Feb 25, 2018
@flash1293 flash1293 changed the title Make wrapper-element ocnfigurable Make wrapper-element configurable Feb 25, 2018
@bitionaire
Copy link

y no merge?

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

Successfully merging this pull request may close these issues.

3 participants