Last active
August 29, 2015 14:19
-
-
Save ericdfields/f6bdd8118229a55499af to your computer and use it in GitHub Desktop.
Disable backspace navigation when textarea has content react mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react') | |
var BackspaceNavHandler = require('backspace_nav_handler_mixins') | |
module.exports = React.createClass({ | |
mixins: [ BackspaceNavHandler ], | |
render: function() { | |
return ( | |
<textarea onBlur={this.disableBackspaceNav} onFocus={this.enableBackspaceNav} /> | |
) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ran into a situation where the component was visible but user brought focus to an entirely unrelated field on the page and of course backspace wouldn't work. This should fix that but will probably fail in contenteditables. Needs a good "is DOM element and input" test.