Skip to content
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] Input field hidden by autocomplete in mobile safari #5544

Closed
petermikitsh opened this issue Nov 12, 2016 · 11 comments
Closed
Labels
bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module!

Comments

@petermikitsh
Copy link
Contributor

Problem description

The user experience of the AutoComplete component on mobile devices could be improved. When you begin typing, the autocomplete options appear on top of the textfield.

The GIF below is from the simulator but it acts identically on a real device.

autocomplete_mobile_safari

Link to minimally-working code that reproduces the issue

Nothing really special here. Just a regular AutoComplete component.

<AutoComplete
  ref={(c) => {
    this.autoComplete = c;
  }}
  floatingLabelText="Add New Administrator"
  fullWidth={true}
  filter={AutoComplete.noFilter}
  openOnFocus={true}
  dataSource={query}
  onUpdateInput={handleUpdateInput}
  floatingLabelFixed={true}
  onNewRequest={() => {
    autoComplete.focus();
  }}
/>

Versions

  • Material-UI: 0.16.1
  • React: 15.3.2
  • Browser: Mobile Safari / iOS Simulator
@petermikitsh
Copy link
Contributor Author

petermikitsh commented Nov 12, 2016

It looks like it has something to do with how positioning is calculated. Hopefully this would narrow down where the buggy code is.

autocomplete_scroll

Edit: it seems to be positioned just right when the page scroll offset is 0. Then the farther up or down you scroll, the more off it gets.

@jamespizzurro
Copy link

jamespizzurro commented Dec 8, 2016

FWIW, I'm also observing this behavior in iOS Safari with material-ui v0.16.4 under React v15.4.1. Does anyone have a workaround in the meantime?

@petermikitsh
Copy link
Contributor Author

@jamespizzurro No fix, and this is just a hunch, but I think the bug is in the Popover implementation (used by AutoComplete). Lots of calculations in there for computing position.

@markusbergh
Copy link

Still experience this with material-ui v0.17.1 and React v15.4.2.

@goldensunliu
Copy link

@oliviertassinari any idea if we have a work around for this for now?

@goldensunliu
Copy link

this is also happening on mobile chrome and FF

import AutoComplete from 'material-ui/AutoComplete'
import Dialog from 'material-ui/Dialog'
class Example extends Component {
  state = {
    dataSource: [],
  };

  handleUpdateInput = (value) => {
    this.setState({
      dataSource: [
        value,
        value + value,
        value + value + value,
      ],
    });
  };

  render() {
    return (
      <Dialog open={true}>
        <AutoComplete
          hintText="Type anything"
          dataSource={this.state.dataSource}
          onUpdateInput={this.handleUpdateInput}
        />
      </Dialog>
    );
  }
}

the popover for the typeahead doesn't anchor correctly. surprisingly it works fine on mobile width, it just happens when the actually user-agent is a mobile one. I suspect it has do with some mobile specific buggy calculations

@EmirGluhbegovic
Copy link

Are there any updates on this issue? I am having the same issue on Safari, mobile safari and mobile chrome. Autocomplete only seems to be working on desktop chrome

@oliviertassinari
Copy link
Member

Closed by #4783

@quorak
Copy link

quorak commented Jan 23, 2018

after some digging through the code and releases. Here are my findings

Lots more effort necessary to make it actually work. lets see.

@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Apr 29, 2020
@giordifungula
Copy link

Is there a solution as I am encouteting the same issue but on mobile for any device with the autocomplete view.
Its appearing over the textfield ? do we need to use a different component or is it the popover?

@oliviertassinari
Copy link
Member

@giordifungula do you have a reproduction with the lastest version of the library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

9 participants