React-bootstrap: Documentation for custom overlays should highlight how important position relative is

Created on 7 Apr 2016  路  3Comments  路  Source: react-bootstrap/react-bootstrap

Documentation: https://react-bootstrap.github.io/components.html#custom-overlays-overlay

It says,

Creating custom overlays is as easy as wrapping some markup in an Overlay component

In reality though you also need to include position: relative in your parent element's CSS or else the overlay will NOT be positioned properly. This is snuck into the example through a style attribute but is not highlighted and so is easy to miss.

From the example code of the above link:

return (
  <div style={{ height: 100, position: 'relative' }}>
    ...
  </div>
);

Most helpful comment

@taion You're right. Either way, it should probably be documented so people don't have to guess it from the code.

All 3 comments

It's not the parent, it's just the container (if specified) that needs to have position: relative.

@taion You're right. Either way, it should probably be documented so people don't have to guess it from the code.

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ckiss picture ckiss  路  3Comments

agile116 picture agile116  路  3Comments

catalinux picture catalinux  路  3Comments

mikejonas picture mikejonas  路  3Comments

radiosilence picture radiosilence  路  3Comments