devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Carbon overflow position hack

Open photodow opened this issue 4 years ago • 0 comments

So I added a setTimeout to position the overflow menu for settings. Something is off here, and this should be looked into more closely either within this codebase, or Carbon. Basically getBoundingClientRect within Carbon is returning 0, and so it's not making the proper calculations. Luckily for our needs at the moment positioning is pretty straightforward.

menuOffsetFlip={menuBody => {
  /* TODO: This is a temporary fix due to some odd bug in carbon/
  chrome that won't allow the getboundingclientrect to get a width.
  In return it won't render properly. This overrides that bit. Keep
  an eye on this. */
  setTimeout(() => {
    menuBody.style.left = 'auto';
    menuBody.style.right = 0;
  }, 0);
}}

https://github.com/carbon-design-system/devtools/blob/master/App/popup/components/MoreOptions/index.js#L16-L22

photodow avatar Oct 02 '20 14:10 photodow