<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gracepoint After Five &#187; widget</title>
	<atom:link href="http://www.gracepointafterfive.com/tag/widget/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gracepointafterfive.com</link>
	<description>A design blog by those of us with day jobs</description>
	<lastBuildDate>Thu, 22 Jul 2010 17:17:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Apple&#8217;s Pretty Search Bar</title>
		<link>http://www.gracepointafterfive.com/apple-search-bar</link>
		<comments>http://www.gracepointafterfive.com/apple-search-bar#comments</comments>
		<pubDate>Fri, 17 Jul 2009 04:25:18 +0000</pubDate>
		<dc:creator>abeyang</dc:creator>
				<category><![CDATA[Our Projects]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.gracepointafterfive.com/?p=97</guid>
		<description><![CDATA[At my company a few years ago, we&#8217;ve been working on some projects that require some heavy UI overhaul. One of these projects requires a &#8220;filter bar&#8221; &#8212; a search bar that filters a long list dynamically. We thought that the typical text fields would clash with the style of our design, so we opted [...]]]></description>
			<content:encoded><![CDATA[<p><span class="drop">A</span>t my company a few years ago, we&#8217;ve been working on some projects that require some heavy UI overhaul. One of these projects requires a &#8220;filter bar&#8221; &#8212; a search bar that filters a long list dynamically.  We thought that the typical <a href="http://www.echoecho.com/htmlforms05.htm" target="_blank">text fields</a> would clash with the style of our design, so we opted for the <a href="http://www.bartelme.at/journal/archive/safaris_search_field/" target="_blank">Safari-esque search field</a> with the rounded corners.</p>
<h2>Initial Setbacks</h2>
<p>Unfortunately, Safari is the only browser currently that (natively) offers this nice-looking search field. What to do, what to do? Well, we could simply fake it, couldn&#8217;t we? That is, we could just have a simple text input field and tack on two rounded sides on the end, no? Unfortunately, it&#8217;s not that easy. You see, in Safari, when you select an input field, it &#8220;glows&#8221;:</p>
<p><img class="size-full wp-image-98" title="safari-search-nogood" src="http://www.gracepointafterfive.com/wp-content/uploads/2009/07/safari-search-nogood.gif" alt="Safari Search Field - no good" width="180" height="35" /></p>
<p>There were other problems that came up along the way:</p>
<ul>
<li>No way to disable glow in Safari, or</li>
<li>no way to only make the outside glow in Safari (if we were just using a standard text input)</li>
<li>Safari uses type=&#8221;search&#8221;. However, that isn&#8217;t W3C compliant.</li>
</ul>
<h2>Solution</h2>
<p>Well, without going into all the boring details as to what we&#8217;ve done, let me just say that we&#8217;ve turned it into a generic framework, and you can download it <a href="http://www.conviodesign.com/downloads/prettyinput.zip">here</a>. A thing to note is that it requires the <a href="http://mootools.net/" target="_blank">Mootools </a>framework.</p>
<h2>Implementation</h2>
<p>We first need to reference the right files. Remember, Mootools go before prettyinput.js.</p>
<p><code class="prettyprint">&lt;script src="mootools.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;<br />
&lt;script src="prettyinput.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;<br />
</code></p>
<p>Next, we&#8217;ll place the input tag inside the HTML file. Note that the span element is optional &#8212; it defines the text inside the search bar.</p>
<p><code class="prettyprint">&lt;label for="YOUR-ID"&gt;<br />
&lt;span class="prettyplaceholder"&gt;Search&lt;/span&gt;<br />
&lt;input id="YOUR-ID" class="prettysearch" type="text" /&gt;<br />
&lt;/label&gt;<br />
</code></p>
<p>Finally, let&#8217;s insert this Javascript snippet in the header.</p>
<p><code class="prettyprint">window.addEvent('domready', function() {<br />
new PrettyInput($('YOUR-ID'));<br />
});<br />
</code></p>
<p>Voila! That&#8217;s it!</p>
<h2>Compatibility</h2>
<p>This is fully compatible with the following browsers:</p>
<ul>
<li>IE6+</li>
<li>Firefox 2+</li>
<li>Safari 2+</li>
</ul>
<p><a href="http://www.gracepointafterfive.com/wp-content/uploads/2009/07/prettyinput.zip">Download PrettySearch</a> (15KB)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gracepointafterfive.com/apple-search-bar/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
