Closed dy closed 4 years ago
Same issue
Thanks for the issue! Definitely is a problem 😔
I fixed it by using mdcSelect.setFixedPosition(true)
after instantiation.
I fixed it by using
mdcSelect.setFixedPosition(true)
after instantiation.
Don't works for me. A Fixed Postion make problems. If you scale the window for example the Selection postion are not updated.
The problem is the Selection must open to the top, not to the bottom. With this you can fix the Problem. But is more a Hack then really a fix. This CSS will open the last Selection to Top.
.mdc-dialog__content {
.mdc-select__menu:last-child {
top: auto !important;
bottom: 56px !important;
}
}
But the calculation of open the menu ist wrong in a Dialog
Using mdc-menu-surface--fixed
can help
Using
mdc-menu-surface--fixed
can help
@arnaudbuy Fixed prevent the cutoff but with it the dropdown start from the center of the select field
Setting menu to fixed position will work with a workaround. Any ancestors of menu should not contain transform
property other than none
.
Workaround for incorrect menu positioning when it is fixed: Set dialog's root elements transform
property to none
.
MDN:
Position
fixed
The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to the initial containing block established by the viewport, except when one of its ancestors has a transform, perspective, or filter property set to something other than none (see the CSS Transforms Spec), in which case that ancestor behaves as the containing block. (Note that there are browser inconsistencies with perspective and filter contributing to containing block formation.) Its final position is determined by the values of top, right, bottom, and left.
@ftaiolivista
The select requires that you set the width of the mdc-selectanchor element as well as setting the width of the mdc-selectmenu element to match.
Set dialog's root elements
transform
property tonone
.
@abhiomkar thats works.
I have this too, but am still using MT 6.0.0. Has this been worked on for 7.0.0 please?
Thanks!
This problem has now been fixed the the Material Theme team. As a note for anybody wondering how to apply this to their own projects, do the following:
mdc-menu-surface--fixed
class to the div that already has the mdc-select__menu
classmy-width-class
to the two div with classes mdc-select__anchor
and mdc-select__menu
my-width-class
, e.g. 200px
Bug report
Select within dialog creates overflow for dropdown menu
That was one of the reasons we used
mdc-select__native-control
, besides #5428 (we can't simply send form data asfetch(url, new FormData(formElement))
now). Also mobiles handle native select dropdowns better.Steps to reproduce
Actual behavior
↑
Expected behavior
Not to have overlay.
Your Environment:
Possible solution
Hoist menu to body in some way?