question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to emulate an input tag?

See original GitHub issue

This may be considered a feature request but it’s more of a question really.

As discussed on Slack, I’d like to make an Editor behave like an input tag.

I think a lot of that boils down to having the content continually scroll to right, and not wrapping.

I’ve tried draft-js-single-line-plugin but the text still wraps on long lines.

I initially tried creating a decorator which didn’t quite work as I wanted, and later got a bit closer with the following CSS:

.public-DraftEditor-content {
  height: 40px;
  overflow: scroll;
  padding-bottom: 10px; /* hide the scrollbar */
}

.public-DraftStyleDefault-block > span {
  white-space: nowrap;
}

This still isn’t quite right and I don’t feel good about styling these elements, but besides that it just seems like there must be a better way.

This could be considered a duplicated of #397, but hopefully this is a more comprehensive report.

Thanks in advance.

cc @makenosound @uiii @jivebot

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
OriRcommented, Oct 11, 2017

@jisaacks Not sure if that’s still relevant for you but I managed to make it scroll on paste. Here’s the fiddle for it: https://jsfiddle.net/orir/m6z0xn4r/317/

@stopachka I used your solution, but this had unexpected consequences in IE. overflow: hidden causes something called hasLayout which is specific to IE that adds resize handles and border to the element.

I know this is a stretch, but is there any other way you might think of to achieve this also in IE?

Edit: A working fiddle in IE - https://jsfiddle.net/m6z0xn4r/319/ to anyone wishing to investigate/experiment

0reactions
benatkincommented, May 23, 2020

Here’s one with the scrollbar hidden. I realize it’s an old version of draft.js. https://jsfiddle.net/ufa2hyp9/

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Simulate Typing in an Input Box with Javascript?
You can use setTimeout and add one character each time like this : var input = document.querySelectorAll("input")[1]; input.select(); // you ...
Read more >
Simulate an input() dialog box - Brython
In this example, we use a generic function dialog() that handles the entry of an integer value in an INPUT tag. It loops...
Read more >
How to simulate pressing enter in HTML text input with Selenium
How to simulate pressing enter in HTML text input with Selenium ? · Import webdriver from selenium · Initialize webdriver path · Open...
Read more >
Input Field Interaction using Interactive Components in Figma
A detailed video showing how to create an input field or text box using ... Tags : Input Field using Interactive Components in...
Read more >
HTMLElement: input event - Web APIs | MDN
For <textarea> and <input> elements that accept text input ( type=text , type=tel , etc.), the interface is InputEvent ; for others, the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found