r105374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105373‎ | r105374 | r105375 >
Date:22:52, 6 December 2011
Author:preilly
Status:resolved (Comments)
Tags:
Comment:
detect pasted text in search
Modified paths:
  • /trunk/extensions/MobileFrontend/javascripts/beta_application.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/javascripts/beta_application.js
@@ -12,6 +12,10 @@
1313 search.addEventListener( 'keydown', handleDefaultText, false );
1414 }
1515
 16+search.onpaste = function() {
 17+ handleDefaultText();
 18+};
 19+
1620 function navigateToLanguageSelection() {
1721 var url;
1822 if ( languageSelection ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r105382fix placeholder issuepreilly23:49, 6 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104950add search placeholderpreilly03:17, 2 December 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   23:24, 6 December 2011

This seems to not work reliably on Android, where we seem to get the trigger after pasting happens, so handleDefaultText() sees that it doesn't match the placeholder text anymore and leaves it as-is.

HTML5 placeholder attribute doesn't work here because that gets hidden when the element has focus; in our case that's always when it's onscreen, defeating the purpose. :P

Talked Patrick into trying an alternate sticking the placeholder in a separate and position it under the input area, so it doesn't interfere. :) This also avoids funky cursor placement issues where it would sometimes be partway through the placeholder text before you start typing or pasting.

Status & tagging log