Skip to content

Commit

Permalink
Wrap setActive with try/catch to ensure silent failing when the texta…
Browse files Browse the repository at this point in the history
…rea is invisible on initial state
  • Loading branch information
Christopher Blum committed Dec 18, 2011
1 parent 1e57d0f commit 215de8f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/views/composer.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@
*
* Other browsers need a more hacky way: (pssst don't tell my mama)
* In order to prevent the element being scrolled into view when focusing it, we simply
* Move it out of the scrollable area, focus it, and reset it's position
* move it out of the scrollable area, focus it, and reset it's position
*/
var focusWithoutScrolling = function(element) {
if (element.setActive) {
element.setActive();
// Following line could cause a js error when the editor is invisible
// See https://github.com/xing/wysihtml5/issues/9
try { element.setActive(); } catch(e) {}
} else {
var elementStyle = element.style,
originalScrollTop = doc.documentElement.scrollTop || doc.body.scrollTop,
Expand Down

0 comments on commit 215de8f

Please sign in to comment.