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

Update popover position when children contents change #966

Merged

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Jul 3, 2018

features / bug fixes

EuiMutationObserver

Adds a component that wraps components with the mutation observer API.
EuiMutationObserver

EuiPortal

A new optional prop called insert that allows the portal to be inserted in arbitrary locations in the DOM.

EuiPortal insert

EuiPopover

Dynamic content

Popover repositions with dynamic content, such as an animated context menu height
fixes #958 fixes #955

EuiPopover dynamic content

Container restriction

An optional container prop allows restricting the popover boundaries
supports canvas euiification

popover container

EuiWrappingPopover

New component that allows non-React DOM elements to be used as popover anchors
supports Kibana navigation euiification

EuiWrappingPopover

todo

  • solve popover jumping around when position is top
  • EuiMutationObserver docs, tests
  • popover with external anchor + docs

browser testing

IE11

  • popover
  • accordion
  • portal
  • context menu

Edge

  • popover
  • accordion
  • portal
  • context menu

Chrome

  • popover
  • accordion
  • portal
  • context menu

FF

  • popover
  • accordion
  • portal
  • context menu

Safari

  • popover
  • accordion
  • portal
  • context menu

@cchaos
Copy link
Contributor

cchaos commented Jul 10, 2018

Not sure if this is in your purview, but I just saw this happen in Kibana where if the contents of the popover itself changes, the position doesn't get updated.

@chandlerprall
Copy link
Contributor Author

@cchaos I've updated this PR to fix that positioning issue for popovers, the tooltip uses separate logic so I've created #996 to track

@chandlerprall chandlerprall force-pushed the bug/955-popover-children-resize branch from 01088fe to 36f7e9f Compare July 11, 2018 17:44
@chandlerprall chandlerprall requested review from nreese and cchaos July 11, 2018 19:21
@chandlerprall chandlerprall force-pushed the bug/955-popover-children-resize branch from 5e3ee29 to aa4f99c Compare July 11, 2018 19:25
@cchaos
Copy link
Contributor

cchaos commented Jul 11, 2018

Is this ready? If so, want to remove the "WIP" from the title?

@chandlerprall chandlerprall changed the title WIP: update popover position when children contents change Update popover position when children contents change Jul 11, 2018
@chandlerprall
Copy link
Contributor Author

@cchaos title updated, thanks!

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work well! I checked in IE11 too for good measure. Had a couple comments, mainly around documentation.

}],
text: (
<p>
<EuiCode>MutationObserver</EuiCode> is a wrapper around the Mutation Observer API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link to the API and describe more about what it is for?

}],
text: (
<p>
There is an optional <EuiCode>insert</EuiCode> prop that can specify the portal&quot;s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the props list won't properly list out what the insert object accepts, can you explain it here.

&quot;s => &apos;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the props tab with a descriptive note, and expanded the writeup.

};
}

setButtonRef = node => this.buttonRef = node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing semicolon


import PopoverContainer from './popover_container';
const popoverContainerSource = require('!!raw-loader!./popover_htmlelement_anchor');
const popoverContainerHtml = renderToHtml(PopoverHTMLElementAnchor);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointing to wrong sources here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch, thanks!

<div>
<p>
<EuiCode>EuiWrappingPopover</EuiCode> is an extra popover component that allows
any existing DOM element to be passed as the <EuiCode>button</EuiCode> prop.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the use-case for this one, but I'm guessing someone needed it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Nathan needs it for the top nav changes.

@chandlerprall
Copy link
Contributor Author

@cchaos pushed changes from your feedback

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thx. Just one grammar issue.

</p>
<p>
<EuiCode>insert</EuiCode> is an object with two key/values: <EuiCode>sibling</EuiCode>
and <EuiCode>position</EuiCode>. sibling is either the React node or HTMLElement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize sibling

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sibling should remain lowercase as the property name itself is lowercase. Verified with @gchaps, who reworded it to read better.

@chandlerprall chandlerprall force-pushed the bug/955-popover-children-resize branch from 1078ac9 to 1db2d3d Compare July 12, 2018 22:15
@chandlerprall chandlerprall force-pushed the bug/955-popover-children-resize branch from 1db2d3d to 66cf140 Compare July 13, 2018 15:16
@@ -189,7 +236,7 @@ export class EuiPopover extends Component {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chandlerprall I just realized I messed up this arrowBuffer value, would you mind setting it to 10 instead of 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY!

@nreese
Copy link
Contributor

nreese commented Jul 18, 2018

This works just as I expected and allows for anchoring popovers to angular elements in Kibana. Below is a screen shot of a popover anchored to a button element rendered by angular. It works as expected. Thanks

screen shot 2018-07-18 at 10 15 18 am

@chandlerprall
Copy link
Contributor Author

jenkins test this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants