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

Allow to use Popup as a generic Popover (do not hard-code orientation) #11299

Open
krassowski opened this issue Oct 16, 2021 · 1 comment
Open

Comments

@krassowski
Copy link
Member

Problem

We would like to use the Popup component in inverse orientation for LSP-RetroLab integration, see jupyter-lsp/jupyterlab-lsp#690. Linking @jtpio's graphic:

image

this is due to different placement in RetroLab (in JupyterLab the indicator is in statusbar and it makes sense for the popup to show above, but in RetroLab it is in the toolbar area and it does not fit if it is opening above).

Currently the placement is hardcoded by privilege: 'forceAbove' in:

private _setGeometry(): void {
let aligned = 0;
const anchorRect = this._anchor.node.getBoundingClientRect();
const bodyRect = this._body.node.getBoundingClientRect();
if (this._align === 'right') {
aligned = -(bodyRect.width - anchorRect.width);
}
const style = window.getComputedStyle(this._body.node);
HoverBox.setGeometry({
anchor: anchorRect,
host: document.body,
maxHeight: 500,
minHeight: 20,
node: this._body.node,
offset: {
horizontal: aligned
},
privilege: 'forceAbove',
style
});
}

Proposed Solution

The Popup should either:

  • a) use above as default, but not be forced to display above if it does not fit, or
  • b) be configurable to allow to specify below, or
  • c) as indeed Popup suggest that it should go up, it could instead inherit from a new Popover which would not have placement restriction.

Which one of a/b/c would you recommend?

Additional context

Analogous Popover component of other frameworks usually allows for any placement:

@krassowski
Copy link
Member Author

And should we then move it to ui-components from statusbar?

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

No branches or pull requests

1 participant