Mention list and emoji top position (Draft.js)

All we need is an easy explanation of the problem, so here it is.

Will you please help me how I can change its position from bottom to top?
I want to show mention list on top of the text instead of the bottom.
The same question about emoji list.

Example link.

enter image description here

enter image description here

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

You can achieve it with positionSuggestions configuration option. This option available for both mention and emoji plugins.

Excerpt from documentation:


The function can be used to manipulate the position of the popover containing the suggestions. It receives one
object as arguments containing the visible rectangle surrounding the
decorated search string including the @. In addition the object
contains prevProps, prevState, state & props. An object should be
returned which can contain all sorts of styles. The defined properties
will be applied as inline-styles.

In constructor you should create plugin this way:

constructor(props) {

  this.mentionPlugin = createMentionPlugin({
    positionSuggestions: (settings) => {
      return {
        left: settings.decoratorRect.left + 'px',
        top: - 40 + 'px', // change this value (40) for manage the distance between cursor and bottom edge of popover
        display: 'block',
        transform: 'scale(1) translateY(-100%)', // transition popover on the value of its height
        transformOrigin: '1em 0% 0px',
        transition: 'all 0.25s cubic-bezier(0.3, 1.2, 0.2, 1)'

And render method:

render() {
  const { MentionSuggestions } = this.mentionPlugin;
  const plugins = [this.mentionPlugin];

  return (
    <div className={editorStyles.editor} onClick={this.focus}>
        ref={(element) => { this.editor = element; }}
      <div style={{ visibility: this.state.suggestions.length ? 'visible' : 'hidden'}}>

Check working example here –

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply