1

I'm currently working with Fluent UI to create a web app, and in this app I'm attempting to create a Fluent UI Dialog with a custom component that contains a Fluent UI ComboBox inside of it. I'm calling ReactDOM.createPortal on return from the render method inside of my custom React object. Upon first use of the Dialog my ComboBox functions as expected, i.e. the dropdown shows properly and it allows me to select and interact with my page as intended. However, when closing the Dialog after having already interacted with the ComboBox, upon re-opening the Dialog the ComboBox no longer displays the dropdown (although I can see the options are still there, just somewhere in the background). I've tried adjusting the zIndex of the ComboBox, it's container, etc. with no luck. I'm starting to think that it's an issue with ReactDOM.createPortal whenever the component is re-rendered after having been interacted with in a previous render, and figured I'd see if anyone has ever tried to do something similar. Thanks so much in advance!

render() {
        const {options, changeOptions} = this.store;

        return (
            <>
                {!!this.item && buttonTexts.length && ReactDOM.createPortal(
                    <ComboBox 
                        label='Title'
                        selectedKey={changeOptions}
                        onChange={this.changeOptionDisplaying}
                        options={options.map(text => ({ key: text, text }))}
                    />,
                    this.item
                )}
                <div ref={this.setRef} dangerouslySetInnerHTML={{ __html: this.props.htmlString}} />
            </>
        )
    }

// this.item is an HTMLDivElement
murky123
  • 120
  • 6

0 Answers0