title: Chrome Extension for Facebook-Clone (automatic "User is listening to...")
body: <p>I'm building a Chrome Extension to replace the current chat's input box with the music I'm currently listening to by the press of "´". Please keep in mind that like in the actual desktop version of Facebook, there is no input/textarea tag element and it's made with react.</p>
  
  <p>I'm stuck at properly replacing the text in the private Facebook-Clone's input, I can see it there, but when I press Enter, it doesn't send.</p>
  
  <p>Screencast of what happens at the moment:
  <a href="https://vimeo.com/203014549" rel="nofollow noreferrer">https://vimeo.com/203014549</a></p>
  
  <p>This private Facebook-Clone works exactly like the actual desktop version of Facebook in regards to the Chat. </p>
  
  <p>content.js:</p>
  
  <pre><code>$(function() {   
        if (window.jQuery) {
  
          $('body').append("&lt;div class='facemusic_tip' style='position:fixed;min-width:400px;width:400px;min-height:20px;height:20px;overflow:scroll;background-color:#000000;top:0;left:0;padding:10px;z-index:99999;color:white'&gt;Press ´ in your message input to inject current song&lt;/div&gt;");
  
          function findAncestor(el, cls) {
              while ((el = el.parentElement) &amp;&amp; !el.classList.contains(cls));
              return el;
          }
  
          $(document).on("keydown", function(e) {
                  if(e.which === 229){
                      var currentmusic =  getCurrentMusicAsString();
                      keytarget = findAncestor(e.target, 'fbNubFlyoutOuter');
                      var $chatbox_outer = $(keytarget);
                      $chatbox_outer.parent('.fbDockChatTabFlyout.uiContextualLayerParent').find("._5rpu").html("I'm listening to: "+currentmusic);
                  }
          });      
        };        
  });
  </code></pre>
  
  <p>UPDATE:<br>
  It seems to be something about react that I don't quite understand, because on enter it just gets replaced with the characters populated by manual keystroke and my manipulated version of the input field is gone, see video for bug.</p>