Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when inserting a div before an editable div (contentEditable) #258

Closed
josdejong opened this issue Aug 5, 2016 · 3 comments
Closed

Comments

@josdejong
Copy link

josdejong commented Aug 5, 2016

When I insert a new div before an editable div, preact throws an error. When clicking the button in this example:

class TestContentEditable extends Component {
  constructor (props) {
    super(props)

    this.state = {
      inserted: false
    }

    this.insert = () => {
      this.setState({inserted: true})
    }
  }

  render () {
    if (this.state.inserted) {
      // => this will insert a new div before the editable div, this gives an error
      return <div>
        <div>not editable?</div>
        <div contentEditable="true">edit here...</div>
      </div>
    }
    else {
      return <div>
        <div contentEditable="true">edit here...</div>
        <button onClick={this.insert}>Insert div before editable div</button>
      </div>
    }
  }
}

This throws the following error in Chrome:

preact.js:158 Uncaught SyntaxError: Failed to set the 'contentEditable' property on 
'HTMLElement': The value provided ('null') is not one of 'true', 'false', 
'plaintext-only', or 'inherit'.

See also this similar virtual-dom issue: Matt-Esch/virtual-dom#176

@josdejong
Copy link
Author

Nevermind, I see I didn't use the latest version of preact, and this issue is fixed in v5.6.0...

I'm really happy with preact btw, thanks! :)

@developit
Copy link
Member

Oh wow, that's awesome! Thanks for the issue report anyway, I'll try to add a test for this so that future changes to this stuff don't break your use-case. Cheers!

@josdejong
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants