git: e4ee79bea4 - main - man.cgi: set the autofocus at the end of the search query
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Sep 2026 11:15:28 UTC
The branch main has been updated by wosch:
URL: https://cgit.FreeBSD.org/doc/commit/?id=e4ee79bea427b1ba364793884bb348e75186d9d9
commit e4ee79bea427b1ba364793884bb348e75186d9d9
Author: Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2026-09-17 11:08:45 +0000
Commit: Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2026-09-17 11:08:45 +0000
man.cgi: set the autofocus at the end of the search query
Most browsers set the the autofocus at the beginning of the
input field which is not very helpful.
---
website/content/en/cgi/man.cgi | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/website/content/en/cgi/man.cgi b/website/content/en/cgi/man.cgi
index c0a31e47ee..342fa87c4f 100755
--- a/website/content/en/cgi/man.cgi
+++ b/website/content/en/cgi/man.cgi
@@ -1458,6 +1458,8 @@ sub html_footer {
print qq[| <a href="$www{'cgi_man'}/help.html">help</a>\n] if !$args{'no_help_link'};
print qq[</span>\n\n];
+ print &input_autofocus_at_end;
+
if (cgi_style::HAS_FREEBSD_CGI_STYLE) {
print q{<hr noshade="noshade" />};
print &cgi_style::html_footer;
@@ -2105,6 +2107,17 @@ qq{Please try a <a href="$BASE?apropos=1&manpath=freebsd-release-ports&q
select undef, undef, undef, 0.35;
}
+sub input_autofocus_at_end {
+ return <<EOF;
+
+<script>
+const input = document.querySelector('#query');
+input.focus();
+input.setSelectionRange(input.value.length, input.value.length);
+</script>
+EOF
+}
+
#
# You may need to precreate some mdoc.local files for every system you
# support (every collection of man pages), maybe like: