-
Notifications
You must be signed in to change notification settings - Fork 81
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
fix: add required vertical space for combo-box overlay #5432
Conversation
* | ||
* @attr {number} required-vertical-space | ||
**/ | ||
requiredVerticalSpace: { |
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.
PositionMixin
is private so didn't label this as a feat
.
* | ||
* @attr {number} required-vertical-space | ||
**/ | ||
requiredVerticalSpace: { |
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.
Not 100% sure about the property name. Any other suggestions? It's for internal use only so it doesn't matter all that much.
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.
Sounds fine. I would suggest to mention in the JsDoc that this effectively disables the content measurement in favor of using this fixed value for determining the open direction.
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.
Updated the description
constructor() { | ||
super(); | ||
|
||
this.requiredVerticalSpace = 200; |
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.
I wonder if 200px is a good default value for combo-box?
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.
Should be a good start. We can consider changing it, or making this configurable if this doesn't fit every use case.
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.
We used to have a hardcoded number in V14 - IIRC, it originates from the 1.x Paper elements based version. It makes no sense already in V10 where we switched to Lumo, but apparently no one noticed it 🙂
Personally, I feel like 200px should be a reasonable default for the minumal overlay height.
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Hi @tomivirkki , this commit cannot be picked to 23.3 by this bot, can you take a look and pick it manually? |
Hi @tomivirkki , this commit cannot be picked to 22.0 by this bot, can you take a look and pick it manually? |
This ticket/PR has been released with Vaadin 24.0.0.beta1 and is also targeting the upcoming stable 24.0.0 version. |
I am thinking I am seeing problems with this change. In HomeAssistant we have If I force required-vertical-space to 0, the overlay.offsetHeight has the correct overlay size and the combo-box opens in the correct direction. But since this required-vertical-space was set to 200, the overlay always acts as if it is 200px in contentHeight for calculating open direction, even if it is larger. Therefore a 400px overlay will still open downwards if it is 300px from the bottom of the screen, leading to the bottom of the overlay being cut off. If not for this required-vertical-space the contentHeight would correctly be 400px and it would open upward instead. from vaadin/overlay/src/vaadin-overlay-position-mixin.js
There seems to be no way to override the requiredVerticalSpace for a vaadin-combo-box-light. Am I misunderstanding something here? |
Description
Since the
<combo-box>
overlay has no intrinsic height,PositionMixin
occasionally had it misaligned on open.A new property
requiredVerticalSpace
was added for thePositionMixin
to cover this case (defining required vertical space for overlays that have no intrinsic height of their own). A default value of200
(pixels) for the property was assigned to the<vaadin-combo-box-overlay>
to fix the issue.Fixes vaadin/flow-components#2820
Type of change
Bugfix