Skip to content

Is there a way to append the suggestions container to the body? #699

Open
@gaurav5430

Description

@gaurav5430

Are you reporting a bug?

I am using the autosuggest within a component which uses overflow-x: hidden, this makes the overflow-y: auto (you can't set it to visible), which leads to a problem where the suggestions box does not overflow out of the parent container even if I make it absolute.

It is similar to the discussion here: https://stackoverflow.com/questions/6421966/css-overflow-x-visible-and-overflow-y-hidden-causing-scrollbar-issue

It is similar to this reported issue: #112

Codepen: https://codepen.io/gaurav5430/pen/YzPVoOe

Steps to reproduce:

  1. Focus on the input field
  2. Type c, and wait for suggestions to appear

Observed behaviour: Suggestions do not appear

Expected behaviour: Suggestions should appear

One solution to the problem is to append the suggestion box to body, since in my case, I can't control the overflow property of the parent.

Is there currently a way to append the suggestions to the body? Also, would any accessibility functionality break if we append it to the body using something like a react portal ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions