From e1a047fd488c93f6296f902743b75dfe7aa7f07a Mon Sep 17 00:00:00 2001 From: Toks Date: Thu, 16 May 2013 09:10:17 -0400 Subject: [PATCH] Revert "better fix for not scrolling textarea" Focusing an offscreen textarea might be bad for usability. --- app/assets/javascripts/related_tag.js | 4 +++- app/assets/javascripts/utility.js | 7 ------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/related_tag.js b/app/assets/javascripts/related_tag.js index 44037b555..77d14a0ae 100644 --- a/app/assets/javascripts/related_tag.js +++ b/app/assets/javascripts/related_tag.js @@ -226,7 +226,9 @@ Danbooru.RelatedTag.process_artist(Danbooru.RelatedTag.recent_artist); } - $field.focusWithoutScroll(); + if ($(window).scrollTop() <= $field.offset().top) { + $field.focus(); + } e.preventDefault(); } diff --git a/app/assets/javascripts/utility.js b/app/assets/javascripts/utility.js index 48b3c0119..42251bab7 100644 --- a/app/assets/javascripts/utility.js +++ b/app/assets/javascripts/utility.js @@ -103,11 +103,4 @@ this.selectRange(this.val().length, this.val().length); return this; } - - $.fn.focusWithoutScroll = function(){ - var x = window.scrollX; - var y = window.scrollY; - this.focus(); - window.scrollTo(x, y); - }; })();