JSFiddle - React, Tailwind, and code Playground

by yeikos

HTML

Go down, focus textbox, press enter and... scroll bar will go up! =( <br/> <br/>
The proof of concept (POC) only works if browser uses webkit

<!-- scroll bar is needed! -->

<div style="margin-top:100%"></div>

<!-- only submit event is affected (always pressing enter key) -->

<form><input type="text"><input type="submit"></form>

<!-- IMPORTANT! this POC only works if the content has got at least a script tag -->

<script></script>

JavaScript

$(function() {
    
    var $body = $('body'), 
        content = $body.html();

   $body.delegate('form', 'submit', function(event) {
       
       $body.html(content);
       
       // solution: $body.html('').html(content); 

       event.preventDefault();
        
    });

});