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.

Using <input> inside a contenteditable="false" is broken in Firefox

See original GitHub issue

We noticed a bug in Firefox, rendering a node as follows is broken:

<div contenteditable="false">
  <input type="text" />
</div>

There are two things to note:

  1. Left/right arrow keys don’t move the caret
  2. Pressing a character key (or backspace) throws an error:

Permission denied to access property “nodeType”

I created a repository reproducing the error with Slate and a minimal setup: http://gabinaureche.com/slate-firefox-bug/

The error comes from isInEditor which tries to read window.getSelection().anchorNode.nodeType but anchorNode is “Restricted”.

This bug is reproducible without Slate, here’s a pretty simple scenario: https://jsfiddle.net/hsqebsk2/1/

I filed an issue to Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1449936

Probably related to #843

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
erquhartcommented, Sep 4, 2018

Just wanted to outline how critical this is, as I’m not certain that’s clear.

This bug means projects that support Firefox, which is most projects, can’t use inputs in Slate, as Slate controls the contenteditable attributes within itself and I think they’re always false for void nodes.

Best repro of this bug is in Slate’s example site - try editing the YouTube video url in firefox: https://www.slatejs.org/#/embeds

I’m working on tracking down the commit where this broke - we ran into it by upgrading slate from ^0.30 to ^0.34 and slate-react from 0.10.11 to 0.12.9.

4reactions
ianstormtaylorcommented, Oct 30, 2018

I’ve rolled back the regression that made inputs inside voids unable to be focused in all browsers, so this issue can remain for the Firefox case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

contenteditable = false in firefox browser - Stack Overflow
I've used this solution here to counter that problem. It detects backspaces and checks if the element right before the caret has contenteditable ......
Read more >
685445 - Contenteditable=false elements ... - Bugzilla@Mozilla
This bug is about Backspace not working on contenteditable=false elements in contenteditable=true elements at all, ever. Delete doesn't work on contenteditable= ...
Read more >
Delete doesn't work correctly on contenteditable=false spans ...
This bug was about Delete not working only right after loading the web page. If you move the caret just one position or...
Read more >
Bogus <br> is inserted at the beginning of contenteditable ...
This happens because while image is selected there's a hidden container in which we store selection. We call it a "fake selection" and...
Read more >
Broken selection system inside of a nested contenteditable ...
The root cause of this bug is that -moz-user-select: all on a parent element overrides it on all children, so once an editable...
Read more >

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