Placeholder for search box.

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
User avatar
Dragosvr92
Registered User
Posts: 624
Joined: Tue May 31, 2011 12:08 pm
Location: Romania
Contact:

Placeholder for search box.

Post by Dragosvr92 » Thu Jul 19, 2012 1:42 pm

As phpbb 3.1.0 finally changed from image-round corners, to borderradius, i think you should also change this bit on the search form.
Find:

Code: Select all

<input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" /> 
Replace with:

Code: Select all

<input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" placeholder="{LA_SEARCH_MINI}" /> 
We already use the html5 doctype, so the placeholder should validate.
The current way of doing it withthe onclick/onblur looks a bit messy/long to me, with that javascript in.
Also, it doesnt work right. If you right click the form the message does not disappear.. Thoughts?
Previous user: TheKiller
Avatar on Memberlist 1.0.3

User avatar
psoTFX
Registered User
Posts: 1984
Joined: Tue Jul 03, 2001 8:50 pm
Contact:

Re: Placeholder for search box.

Post by psoTFX » Thu Jul 19, 2012 2:08 pm

Seems sensible to me - though on chrome the placeholder vanishes.

User avatar
Dragosvr92
Registered User
Posts: 624
Joined: Tue May 31, 2011 12:08 pm
Location: Romania
Contact:

Re: Placeholder for search box.

Post by Dragosvr92 » Thu Jul 19, 2012 3:48 pm

You are right, sort of. The placeholder text doesnt vanish. it stays there as background text, till you write something. Wont dis/re-appear on mouse click.
Previous user: TheKiller
Avatar on Memberlist 1.0.3

User avatar
naderman
Product Manager
Product Manager
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: Placeholder for search box.

Post by naderman » Thu Jul 19, 2012 4:00 pm

Sounds like a good idea, just create a ticket and send a pull request please.

User avatar
Vinny
Style Customisations
Style Customisations
Posts: 126
Joined: Thu May 20, 2010 4:01 am
Location: Brazil
Contact:

Re: Placeholder for search box.

Post by Vinny » Thu Jul 19, 2012 5:25 pm

Good idea. +1

Senky
Extension Customisations
Extension Customisations
Posts: 283
Joined: Thu Jul 16, 2009 4:41 pm

Re: Placeholder for search box.

Post by Senky » Thu Jul 19, 2012 6:25 pm

+1

User avatar
callumacrae
Infrastructure Team
Infrastructure Team
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Placeholder for search box.

Post by callumacrae » Thu Jul 19, 2012 6:32 pm

+1 - but possibly write some code that detects whether placeholder is available (modernizr, anyone?) and adds an onclick fallback.
Made by developers, for developers!
My blog

User avatar
Dragosvr92
Registered User
Posts: 624
Joined: Tue May 31, 2011 12:08 pm
Location: Romania
Contact:

Re: Placeholder for search box.

Post by Dragosvr92 » Thu Jul 19, 2012 7:28 pm

I created the ticket, but what pull request?

@callum, i thought about that, to support older browsers too, but it may be too messy to support older browsers.

border radius isnt supported on older browsers (IE8 etc) and no hack was included in phpbb.
Previous user: TheKiller
Avatar on Memberlist 1.0.3

User avatar
callumacrae
Infrastructure Team
Infrastructure Team
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Placeholder for search box.

Post by callumacrae » Thu Jul 19, 2012 7:34 pm

It's a very easy fallback to implement, unlike with border-radius which would be horrific. Also, with "Search" it isn't too clear what the box does.
Made by developers, for developers!
My blog

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: Placeholder for search box.

Post by nickvergessen » Thu Jul 19, 2012 7:36 pm

As per viewtopic.php?f=108&t=43115 the data attribute should be prefixed with phpbb-data-*

Edit: sorry I misunderstood this, I thought it was ment to be implemented with ajax. But maybe that's still interesting for the fall back
Member of the Development-TeamNo Support via PM

Post Reply