react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

AutocompleteInput component does not show suggestions in Modal (like Dialog or Drawer)

Open mikethebeer opened this issue 6 years ago • 3 comments

What you were expecting: <AutocompleteInput /> should list suggestions in a modal view (e.g. within Material UI drawer or Dialog).

What happened instead: Suggestion list of <AutocompleteInput /> is hidden by the modal (Drawer / Dialog) because of the wrong z-index the <AutocompleteSuggestionList /> is rendered (see https://github.com/marmelab/react-admin/blob/v3.8.2/packages/ra-ui-materialui/src/input/AutocompleteSuggestionList.tsx#L9)

Steps to reproduce: Create a <SimpleForm /> within a <Dialog /> modal and use the <AutocompleteInput /> ui component.

Related code: https://github.com/marmelab/react-admin/blob/v3.8.2/packages/ra-ui-materialui/src/input/AutocompleteSuggestionList.tsx#L9

Environment

  • React-admin version: 3.8.2
  • Last version that did not exhibit the issue (if applicable): -
  • React version: any
  • Browser: any
  • Stack trace (in case of a JS error): -

mikethebeer avatar Aug 24 '20 13:08 mikethebeer

This is explained here: https://github.com/marmelab/react-admin/issues/2456#issuecomment-432224631.

If you need to use modals, then you'll have to provide your own Layout component and your own Notification component, overriding its styles to adjust its z-index

djhi avatar Aug 24 '20 14:08 djhi

@djhi thanks for the reply and the hint with using the withStyles decorator here.

mikethebeer avatar Aug 25 '20 06:08 mikethebeer

We should probably add a note about it in the documentation though

djhi avatar Aug 25 '20 07:08 djhi