react-textarea-autocomplete icon indicating copy to clipboard operation
react-textarea-autocomplete copied to clipboard

Prevent autocomplete to change position (set fix position)

Open teilzeitgeist opened this issue 6 years ago • 8 comments

Is there a way to prevent the autocomplete opening at the top of the textarea?

Because on the one hand the change is annoying and on the other it's in my case buggy: bug

teilzeitgeist avatar May 02 '19 08:05 teilzeitgeist

Have you tried to play with boundariesElement prop? Maybe it would be good to allow false option to disable it.

jukben avatar May 02 '19 08:05 jukben

Yeah, but unfortunately boundariesElement does not work with (because the autocomplete have to be inside the boundariesElement) or without renderToBody (same behavior you can see in the GIF).

So ... an additional prop will be great!

For example like: autocompletePostionX: auto | left | right autocompletePostionY: auto | top | bottom

teilzeitgeist avatar May 02 '19 09:05 teilzeitgeist

Yeah, agree, more like

autocompletePostion={{
	x: "auto | left | right",
	y: "auto | top | bottom"
}}

defaults to auto

What do you think?

jukben avatar May 02 '19 12:05 jukben

Sounds perfect to me 😎

teilzeitgeist avatar May 02 '19 13:05 teilzeitgeist

I can try tackle it on weekend, but if you have some time for it, you have green light!

jukben avatar May 02 '19 13:05 jukben

Sounds great!

I had another case in which the autocomplete has the wrong position (renderToBody is true): image (The bottom of the image is the bottom of the browser window)

Maybe the calculation of the autocomplete position with the new renderToBody prop is not correct.

teilzeitgeist avatar May 08 '19 09:05 teilzeitgeist

Ah, sorry about it. I would be great to revisit it then. Although, I think that the proposed prop autocompletePostion makes sense anyway.

jukben avatar May 08 '19 21:05 jukben

The wrong calculation of the autcomplete position was my bad 🤦‍♂ .rta__autocomplete was set to display: none; by default ... so the dropdownBounds variable was empty. Now it works.

Anyway the autocompletePostion prop would be great 👍

teilzeitgeist avatar Oct 22 '19 13:10 teilzeitgeist