-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[AutoComplete] DropDown Positioning #4393
Comments
You can actually restrict the menu height and make the results scrollable by using the menuStyle property, like this:
Also, setting openOnFocus makes the full list of results come up when you just click into the field.
But yeah, +1 for the other issues... |
having param something like 'position' would help. E.g. right now i need to figure how to push all the list left from input, i have small space on right and list is 600px in width.
|
I managed to make autocomplete to "open up" by using:
and
But I couldn't figured out exactly why this worked (setting targetOrigin to "bottom" didn't make sense to me). Besides, when the first letter is typed, the menu opens down. Only after I type the second letter it opens up. Does anybody know why is that? |
+1 still an issue |
this is ridiculous. It's not a bug, it's actually a feature which is essential for me to release such a component. |
To allow scrolling of the menu when it goes off the bottom of the screen:
|
liamcmitchell, that works great when you have a large number of items in the list, but awful if your list is small: the dropdown will always extend to the bottom. |
This bug is compounded when the AutoComplete is used in a Dialog, where the page can not scroll and the items that are outside the current window are entirely unreachable. Perhaps the way to fix this is to modify the PopOver component to have a prop that allows css style max-height of its first child div to window.innerHeight - the divs .top |
Looks like Popover option This should do the trick : popoverProps={{
canAutoPosition: true
}} |
when i open modal my page is auto scroll up how can i solve this problem |
Hm... it looks like when AutoComplete is scrolled inside body tag everything is working ok (like on demo/docs page), when You want to have it scrolled inside any other container it does not - it stays in the same place (fixed position calculated from body tag). Here is jsfiddle using v0.18.5 showing the problem https://jsfiddle.net/k52fdwm5/14/ Any clues how it should be handled? My idea is to change default placement of Popover in DOM, as a last child of parent of anchorEl. |
Hm... After some debugging I've end up with propagating scroll event to window from container that is scrolled: @oliviertassinari do You have any idea how to do it properly inside AutoComplete? My first idea would be PS: Code should be IE 9.0+ compatible: http://caniuse.com/#search=event |
The issue is probably with Popover itself and not with auto-complete and such.. On |
@slavab89 My workaround just fire new scroll event on window, I'm not sure whether it could scroll window/body somehow, on chrome it looks like it does not - probably beacuse I do not set any variables connected with scrollY, scrollX on the Event()? |
Not sure as well. In any case i am too using your workaround for now. To make it a bit better i've wrapped the |
Basically, the problem is in Popover.js which uses the EventListener and target has been set as 'window'. So, if a prop is provided to set the target of EventListener (it could be an object or string like id of element), it will work. But, there is another problem which is in setPlacement method of Popover.js. While setting the top position of target element, it uses Math.max to get the positive values only as If we changed that part as |
I think we need someone from the core to shed some light what is current status of autocomplete - for now it is not available in 1.0 branch... @gorkemcnr Your idea is basically what I've proposed already:
If You have some time You can try to prepare PR for this... @oliviertassinari any update on this? |
@lechup The progress on the 1.0 branch is tracked on this issue #4783. Long story short, I think we would better off by not porting the component. Instead, documenting how to use external libraries like react-autosuggest or providing an adapter. That goes into the strategy of having the v1 less opinionated and closer to our core business. The 50+ issues show that building such component is hard. |
Closed by #4783 |
* #4783 - As discussed on #4393 and #4783 I have provided a fix for popover position issue on autocomplete. * Update Popover.js * -Commented PR changes are applied -Prop name is changed to a more meaningful name * Update Popover.js * Prop order is changed as alphabetical order * redundant space removed * redundant space is removed
* #4783 - As discussed on mui/material-ui#4393 and mui/material-ui#4783 I have provided a fix for popover position issue on autocomplete. * Update Popover.js * -Commented PR changes are applied -Prop name is changed to a more meaningful name * Update Popover.js * Prop order is changed as alphabetical order * redundant space removed * redundant space is removed
Problem description
Autocomplete has 4 major usability problems:
Steps to reproduce
Place an autocomplete within a scrollable div where it does not have enough height to render all results.
Versions
The text was updated successfully, but these errors were encountered: