From f2d61496afc17db7c6a34d06236c34d4fcbefb58 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 28 Mar 2013 16:58:30 -0400 Subject: [PATCH] Fix automatic selection of share link --- app/assets/javascripts/discourse/views/share_view.js | 8 +++++++- app/assets/stylesheets/application/share_link.css.scss | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/views/share_view.js b/app/assets/javascripts/discourse/views/share_view.js index 24c9688d304..9bda689a951 100644 --- a/app/assets/javascripts/discourse/views/share_view.js +++ b/app/assets/javascripts/discourse/views/share_view.js @@ -23,7 +23,13 @@ Discourse.ShareView = Discourse.View.extend({ linkChanged: (function() { if (this.present('controller.link')) { - $('#share-link input').val(this.get('controller.link')).select().focus(); + var $linkInput = $('#share-link input'); + $linkInput.val(this.get('controller.link')); + + // Wait for the fade-in transition to finish before selecting the link: + window.setTimeout(function() { + $linkInput.select().focus(); + }, 160); } }).observes('controller.link'), diff --git a/app/assets/stylesheets/application/share_link.css.scss b/app/assets/stylesheets/application/share_link.css.scss index 919ccdbce0c..bed23c60ebb 100644 --- a/app/assets/stylesheets/application/share_link.css.scss +++ b/app/assets/stylesheets/application/share_link.css.scss @@ -12,7 +12,7 @@ background-color: $light_gray; padding: 3px 7px 6px 7px; width: 300px; - @include fades-in(0.25s); + @include fades-in(0.15s); &.visible { @include visible; }