Merge lp:~jcsackett/launchpad/autofocus into lp:launchpad

Proposed by j.c.sackett on 2010-12-20
Status: Merged
Approved by: j.c.sackett on 2010-12-21
Approved revision: no longer in the source branch.
Merged at revision: 12135
Proposed branch: lp:~jcsackett/launchpad/autofocus
Merge into: lp:launchpad
Diff against target: 57 lines (+14/-0)
4 files modified
lib/lp/app/templates/root-index.pt (+3/-0)
lib/lp/blueprints/templates/specifications-index.pt (+4/-0)
lib/lp/code/templates/bazaar-index.pt (+4/-0)
lib/lp/registry/templates/projects-index.pt (+3/-0)
To merge this branch: bzr merge lp:~jcsackett/launchpad/autofocus
Reviewer Review Type Date Requested Status
Leonard Richardson (community) 2010-12-20 Approve on 2010-12-21
Review via email: mp+44284@code.launchpad.net

Commit Message

[r=leonardr][ui=none][bug=135009,135012,135015,135018] Adds autofocus to several fields needing it throughout Launchpad

Description of the Change

Summary
=======

A number of search fields should auto focus on page load, and do not. This adds auto focus to those forms/fields.

Preimplemenation Talk
=====================

Spoke with Curtis Hovey about how to set auto focus.

Implementation
==============

lib/lp/app/templates/root-index.pt
lib/lp/registry/templates/projects-index.pt
lib/lp/code/templates/bazaar-index.pt
lib/lp/blueprints/templates/specifications-index.pt
---------------------------------------------------

In each file, added setFocusByName to the template for the form as it has been used elsewhere.

Demo & QA
=========

Open http://blueprints.launchpad.dev/; the search field should get focus
Open http://code.launchpad.dev/; the search field should get focus
Open http://launchpad.dev/projects; the search field should get focus
Open http://launchpad.dev/; the search field should get focus

To post a comment you must log in.
Leonard Richardson (leonardr) wrote :

Approved, assuming that the inputs mentioned in setFocusByName will always be present. (As far as I can tell by looking at the code, this is the case.)

review: Approve
j.c.sackett (jcsackett) wrote :

> Approved, assuming that the inputs mentioned in setFocusByName will always be present.

That is the case; in each case the javascript is loaded after the form loads, and the form is not dynamic in nature.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/templates/root-index.pt'
2--- lib/lp/app/templates/root-index.pt 2010-12-16 16:21:07 +0000
3+++ lib/lp/app/templates/root-index.pt 2010-12-21 15:14:53 +0000
4@@ -164,6 +164,9 @@
5 <input id="text" type="text" name="field.text" size="25%" />
6 <input id="search" type="submit" value="Search Launchpad" />
7 </form>
8+ <script type="text/javascript"><!--
9+ setFocusByName('field.text');
10+ // --></script>
11 <div id="homepage-stats" tal:content="cache:public, 1 hour">
12 <strong class="registry-stat"
13 tal:content="view/project_count/fmt:intcomma">123</strong>&nbsp;projects,
14
15=== modified file 'lib/lp/blueprints/templates/specifications-index.pt'
16--- lib/lp/blueprints/templates/specifications-index.pt 2009-09-21 17:21:57 +0000
17+++ lib/lp/blueprints/templates/specifications-index.pt 2010-12-21 15:14:53 +0000
18@@ -71,6 +71,10 @@
19 </tbody>
20 </table>
21 </form>
22+ <script type="text/javascript"><!--
23+ setFocusByName('field.search_text');
24+ // --></script>
25+
26 <tal:searchresults condition="view/searchrequested"
27 define="specs view/specs" >
28 <p tal:condition="specs">
29
30=== modified file 'lib/lp/code/templates/bazaar-index.pt'
31--- lib/lp/code/templates/bazaar-index.pt 2010-12-13 10:16:37 +0000
32+++ lib/lp/code/templates/bazaar-index.pt 2010-12-21 15:14:53 +0000
33@@ -38,6 +38,10 @@
34 <input id="text" type="text" name="text" size="50" />
35 <input type="submit" value="Find a Project" />
36 </form>
37+ <script type="text/javascript"><!--
38+ setFocusByName('text');
39+ // --></script>
40+
41 <p id="application-summary">
42 Launchpad can host your project&#8217;s source code
43 using the <a href="http://bazaar.canonical.com/">Bazaar</a>
44
45=== modified file 'lib/lp/registry/templates/projects-index.pt'
46--- lib/lp/registry/templates/projects-index.pt 2010-01-12 14:36:46 +0000
47+++ lib/lp/registry/templates/projects-index.pt 2010-12-21 15:14:53 +0000
48@@ -33,6 +33,9 @@
49 tal:condition="not: view/search_requested"
50 type="submit" value="Search project groups" />
51 </form>
52+ <script type="text/javascript"><!--
53+ setFocusByName('text');
54+ // --></script>
55
56 <div tal:condition="view/search_requested">
57 <tal:searching condition="view/search_results">