JSFiddle - React, Tailwind, and code Playground

by sawsym

HTML

<div contenteditable="true" class="edit" onblur="scrollBack(this)">This is a Test case,Its a testing text not actual text</div>

CSS

.edit {
    width:150px;
    height:20px;
    background:#dcdcdc;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap
}

.edit:focus {
  text-overflow: initial;
}

JavaScript

function scrollBack (el) {
	el.scrollLeft = 0;
}