Title: PlainText in Modal
Last modified: October 8, 2019

---

# PlainText in Modal

 *  Resolved [lacika1981](https://wordpress.org/support/users/lacika1981/)
 * (@lacika1981)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/plaintext-in-modal/)
 * Hi,
 * I am trying to create a popup that will have a PlainText component.
    In this 
   PlainText component you can add some text that would update attributes onChange.
   I took the code from WordPress documentation and added PlainText component to
   it. What I want to do might be bad practise. The problem is that as soon as I
   start typing in the text field the Modal closes. When I open it again the character
   is there and if I try to type again the same happens.
 * Thank you
 * Here is my code
 *     ```
       const MyModal = withState( {
                   isOpen: false,
               } )( ( { isOpen, setState } ) => (
                   <div>
                       <Button isDefault onClick={ () => setState( { isOpen: true } ) }>Open Modal</Button>
                       { isOpen && (
                           <div>
                           <Modal
                               title="This is my modal"
                               onRequestClose={ () => setState( { isOpen: false } ) }
                               shouldCloseOnClickOutside="false">
                               <PlainText
                                   onChange={ (content) => setAttributes( { arielButton: content } ) }
                                   value={ attributes.arielButton }
                               />
                           </Modal>
                           </div>
                       ) }
                   </div>
               ) );
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [Jorge Costa](https://wordpress.org/support/users/jorgefilipecosta/)
 * (@jorgefilipecosta)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/plaintext-in-modal/#post-12146537)
 * Hi,
 * If the attribute you are updating is used in a RichText component, you are facing
   a Gutenberg bug that is being addressed on [https://github.com/WordPress/gutenberg/pull/17617](https://github.com/WordPress/gutenberg/pull/17617).
   Feel free to share your use case or any other relevant information on the pull
   request.
 * If that’s not the case. We are in the presence of an unknown bug that should 
   be investigated. In that case, could you submit a bug report at [https://github.com/WordPress/gutenberg/issues/new?template=Bug_report.md](https://github.com/WordPress/gutenberg/issues/new?template=Bug_report.md)
   
   and confirm if when the onChange line is commented the problem still happens?
   And if no if, the PlainText value is stored in the local state the problem persists?
 * Thank you in advance!

Viewing 1 replies (of 1 total)

The topic ‘PlainText in Modal’ is closed to new replies.

 * ![](https://ps.w.org/gutenberg/assets/icon-256x256.jpg?rev=1776042)
 * [Gutenberg](https://wordpress.org/plugins/gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gutenberg/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Jorge Costa](https://wordpress.org/support/users/jorgefilipecosta/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/plaintext-in-modal/#post-12146537)
 * Status: resolved