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.

floating blocks cause placeholder to be mispositioned

See original GitHub issue

floating

<div>
  <img style="float: left">
  <Slate />
</div>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ianstormtaylorcommented, Jul 26, 2016

Okay, good news and bad news!

Your question prompted me to deep dive into the placeholder. And turns out we don’t actually need to use a <Portal> to render it. So I was able to simplify how it’s rendered. Now it’s just a child at the same level with contentEditable={false}.

But, it’s still positioned absolutely by default, since this it the best for general cases.

But but, you should be able to pass style={...} to it, so you can customize it to handle your case. I believe you’ll want to float it to the left, and use make it zero-width. Something like:

style={{
  position: 'relative',
  float: 'left',
  width: '0px',
  marginRight: 'none',
  whiteSpace: 'nowrap'
}}

I think that will do it. The reason it’s not on by default is that it breaks for multi-line placeholders, so you’ll have to make sure your placeholder text is really short.

That’s the best I think we can do! But if anyone figures out a more bulletproof set of styles for the default let me know.

0reactions
aeneasrcommented, Jul 26, 2016

ok I’ll check it out, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

1323517 - float with writing-mode orthogonal to its containing block ...
My first guess at where this would be going wrong is that for some reason this test would be failing when it should...
Read more >
How to fix wrongly positioned draggable helpers for ...
I'm experiencing a problem where the draggable helper is being offset incorrectly, when using draggables + sortables that are placed in floating ...
Read more >
Floated Labels Still Suck - Web Axe
The post points out that it's bad practice to use text to look and behave as a placeholder rather than a label. This...
Read more >
Blazy filter messes up the node body html [#3081148] - Drupal
The result is that the html content of these block gets messed up AND some of the blazy loaded images from the main...
Read more >
FCKeditor ChangeLog - What's New?
[#2065] Floating dialogs will now block the user from re-selecting the editing area by pressing Tab. [#2114] Added a workaround for an IE6...
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