-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Support host and ref options in Menu.open #700
Support host and ref options in Menu.open #700
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
forceY: boolean | ||
forceY: boolean, | ||
host: HTMLElement | null, | ||
ref: HTMLElement | null | ||
): void { | ||
// Get the current position and size of the main viewport. | ||
const windowData = getWindowData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the proposed changes the menu could end up beyond the boundaries of the element. This will be potentially problematic if the parent element (host) has clips the menu off. Is my thinking correct?
I think this is fine to merge as-is, I just wonder if this should be documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, your thinking is correct. But it isn't a result of these changes, it was always possible for the menu to be outside of the host
element. That is essentially what the ipydatagrid
problem using voila
was, the menu was appearing outside of the body
, which I didn't think was even possible but it is correct following the rules of CSS absolute positioning.
I will add a note about this.
You will need to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ianthomas23
FYI (not requiring code changes) it is better to used the non nullish operator ??
rather than the or operator.
The reason or is used a lot in lumino is that the code predates the introduction of that operator.
The goal is to avoid the case of a falsy value being overridden by the default like 0 || 1
!= 0 ?? 1
(the first equals one when the second equals 0).
[warn] packages/widgets/tests/src/menu.spec.ts |
Thanks for the guidance @krassowski and @fcollonval. I've added the extra documentation to |
I cannot tell if the failing |
This is due to flakiness - I let @krassowski have a second look. |
gentle ping to @krassowski |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Implements enhancement #699.
This exposes the
Widget.attach
optional argumentshost
andref
inMenu.IOptions
to provide greater control over exactly where in the DOM the menudiv
is attached.I have kept the names and descriptions of the options the same as in
Widget.attach
.