[aur-dev] [PATCH] autofocus on search input

Lukas Fleischer lfleischer at archlinux.org
Fri Jan 22 21:46:56 UTC 2016


On Thu, 21 Jan 2016 at 22:34:11, Juan M. Uys wrote:
> When loading the home page, it would be quite convenient for the search
> input box to receive focus.

Sounds good.

> Other possible enhancements:
> - set the search input box's tabindex to the lowest value
> - implement a JS-based keyboard shortcut mechanism bound to '/', and
>   upon pressing key '/', the search input box receives focus.

This part does not belong in the commit message...

> ---
>  web/html/home.php | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/web/html/home.php b/web/html/home.php
> index 475370b..90abeac 100644
> --- a/web/html/home.php
> +++ b/web/html/home.php
> @@ -130,7 +130,7 @@ html_header( __("Home") );
>                         <fieldset>
>                                 <label for="pkgsearch-field"><?= __('Package Search') ?>:</label>
>                                 <input type="hidden" name="O" value="0" />
> -                               <input id="pkgsearch-field" type="text" name="K" size="30" value="<?php if (isset($_REQUEST["K"])) { print stripslashes(trim(htmlspecialchars($_REQUEST["K"], ENT_QUOTES))); } ?>" maxlength="35" />
> +                               <input id="pkgsearch-field" type="text" name="K" size="30" value="<?php if (isset($_REQUEST["K"])) { print stripslashes(trim(htmlspecialchars($_REQUEST["K"], ENT_QUOTES))); } ?>" maxlength="35" autofocus="" />
> [...]

On the package search page, we use autofocus="autofocus" instead of
using an empty value. I don't think it makes a difference but maybe we
should use autofocus="autofocus" here as well for consistency.

Thanks!


More information about the aur-dev mailing list