-
Notifications
You must be signed in to change notification settings - Fork 83
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
Changes from all commits
f4d05d8
2bc7481
b372cba
8d53297
b9b1d1f
bf65794
529a183
0a0c8f7
35c1b6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,12 +93,25 @@ export const PositionMixin = (superClass) => | |
type: Boolean, | ||
value: false, | ||
}, | ||
|
||
/** | ||
* If the overlay content has no intrinsic height, this property can be used to set | ||
* the minimum vertical space (in pixels) required by the overlay. Setting a value to | ||
* the property effectively disables the content measurement in favor of using this | ||
* fixed value for determining the open direction. | ||
* | ||
* @attr {number} required-vertical-space | ||
*/ | ||
requiredVerticalSpace: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Updated the description |
||
type: Number, | ||
value: 0, | ||
}, | ||
}; | ||
} | ||
|
||
static get observers() { | ||
return [ | ||
'__positionSettingsChanged(horizontalAlign, verticalAlign, noHorizontalOverlap, noVerticalOverlap)', | ||
'__positionSettingsChanged(horizontalAlign, verticalAlign, noHorizontalOverlap, noVerticalOverlap, requiredVerticalSpace)', | ||
'__overlayOpenedChanged(opened, positionTarget)', | ||
]; | ||
} | ||
|
@@ -262,7 +275,8 @@ export const PositionMixin = (superClass) => | |
__shouldAlignStartVertically(targetRect) { | ||
// Using previous size to fix a case where window resize may cause the overlay to be squeezed | ||
// smaller than its current space before the fit-calculations. | ||
const contentHeight = Math.max(this.__oldContentHeight || 0, this.$.overlay.offsetHeight); | ||
const contentHeight = | ||
this.requiredVerticalSpace || Math.max(this.__oldContentHeight || 0, this.$.overlay.offsetHeight); | ||
sissbruecker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.__oldContentHeight = this.$.overlay.offsetHeight; | ||
|
||
const viewportHeight = Math.min(window.innerHeight, document.documentElement.clientHeight); | ||
|
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.