git: 67fa1c9b18 - main - ports.cgi: don't auto-open keyboard on Android
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Sep 2026 18:44:32 UTC
The branch main has been updated by wosch:
URL: https://cgit.FreeBSD.org/doc/commit/?id=67fa1c9b1868b22670647426c89603fe4c7c501a
commit 67fa1c9b1868b22670647426c89603fe4c7c501a
Author: Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2026-09-20 18:44:13 +0000
Commit: Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2026-09-20 18:44:13 +0000
ports.cgi: don't auto-open keyboard on Android
---
website/content/en/cgi/ports.cgi | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/website/content/en/cgi/ports.cgi b/website/content/en/cgi/ports.cgi
index 7c34a4b1df..81c1af5091 100755
--- a/website/content/en/cgi/ports.cgi
+++ b/website/content/en/cgi/ports.cgi
@@ -60,6 +60,22 @@ span#noscript { color: red; font-size: normal; font-weight: bold; }
</style>
<link rel="search" type="application/opensearchdescription+xml" href="https://www.freebsd.org/opensearch/ports.xml" title="FreeBSD Ports" />
+
+<script>
+function input_autofocus_at_end () {
+ const input = document.querySelector('#query');
+ if (input) {
+ // XXX: don't auto-open keyboard on Android
+ input.setAttribute('readonly', 'readonly');
+ input.focus({ preventScroll: true });
+ setTimeout(function () {
+ input.removeAttribute('readonly');
+ input.setSelectionRange(input.value.length, input.value.length);
+ }, 50);
+ }
+}
+document.addEventListener('DOMContentLoaded', input_autofocus_at_end);
+</script>
`;
my $no_javascript_warning = <<'EOF';
@@ -605,22 +621,11 @@ sub search_ports {
}
}
-sub input_autofocus_at_end {
- return <<EOF;
-
-<script type="text/javascript">
-const input = document.querySelector('#query');
-input.focus();
-input.setSelectionRange(input.value.length, input.value.length);
-</script>
-EOF
-}
-
sub forms {
print qq{
<form id="ports" method="get" action="$script_name">
-<input name="query" id="query" value="$query" type="text" autocapitalize="none" autofocus />
+<input name="query" id="query" value="$query" type="text" autocapitalize="none" />
<select name="stype">
};
@@ -964,6 +969,5 @@ if ($counter) {
print &footer_links;
}
-print &input_autofocus_at_end;
print qq{<hr noshade="noshade" />\n};
print &html_footer;