]> git.joonet.de Git - adminer.git/commitdiff
Use autofocus HTML attribute
authorJakub Vrana <jakub@vrana.cz>
Sun, 16 Feb 2025 17:23:07 +0000 (18:23 +0100)
committerJakub Vrana <jakub@vrana.cz>
Wed, 19 Feb 2025 10:16:45 +0000 (11:16 +0100)
adminer/create.inc.php
adminer/database.inc.php
adminer/include/adminer.inc.php
adminer/include/driver.inc.php
adminer/scheme.inc.php
changes.txt
editor/include/adminer.inc.php

index 905ff39000b6eb47f7b191bc66eec63a75ee2253..92e375cb37376beac0247eac000e977d46d62459 100644 (file)
@@ -181,8 +181,7 @@ foreach ($engines as $engine) {
 <form action="" method="post" id="form">
 <p>
 <?php if (support("columns") || $TABLE == "") { ?>
-<?php echo lang('Table name'); ?>: <input name="name" data-maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
-<?php if ($TABLE == "" && !$_POST) { echo script("focus(qs('#form')['name']);"); } ?>
+<?php echo lang('Table name'); ?>: <input name="name"<?php echo ($TABLE == "" && !$_POST ? " autofocus" : ""); ?> data-maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
 <?php echo ($engines ? "<select name='Engine'>" . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "</select>" . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") : ""); ?>
  <?php echo ($collations && !preg_match("~sqlite|mssql~", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
  <input type="submit" value="<?php echo lang('Save'); ?>">
index bc5e4dbf3ff79c56fd8f356b499360e940030648..355dd56eadc41fa99aadd93f8caf3cade7556201 100644 (file)
@@ -59,14 +59,13 @@ if ($_POST) {
 <p>
 <?php
 echo ($_POST["add_x"] || strpos($name, "\n")
-       ? '<textarea id="name" name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
-       : '<input name="name" id="name" value="' . h($name) . '" data-maxlength="64" autocapitalize="off">'
+       ? '<textarea autofocus name="name" rows="10" cols="40">' . h($name) . '</textarea><br>'
+       : '<input name="name" autofocus value="' . h($name) . '" data-maxlength="64" autocapitalize="off">'
 ) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $row["collation"]) . doc_link(array(
        'sql' => "charset-charsets.html",
        'mariadb' => "supported-character-sets-and-collations/",
        'mssql' => "ms187963.aspx",
 )) : "");
-echo script("focus(qs('#name'));");
 ?>
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
index cb86b1636cd25edcb4a3329eeaa6693bcdfad0be..e5dafa71b55661feea08e900d0ef388ab90636e3 100644 (file)
@@ -121,7 +121,7 @@ class Adminer {
                echo "<table cellspacing='0' class='layout'>\n";
                echo $this->loginFormField('driver', '<tr><th>' . lang('System') . '<td>', html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);") . "\n");
                echo $this->loginFormField('server', '<tr><th>' . lang('Server') . '<td>', '<input name="auth[server]" value="' . h(SERVER) . '" title="hostname[:port]" placeholder="localhost" autocapitalize="off">' . "\n");
-               echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("focus(qs('#username')); qs('#username').form['auth[driver]'].onchange();"));
+               echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" autofocus value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("qs('#username').form['auth[driver]'].onchange();"));
                echo $this->loginFormField('password', '<tr><th>' . lang('Password') . '<td>', '<input type="password" name="auth[password]" autocomplete="current-password">' . "\n");
                echo $this->loginFormField('db', '<tr><th>' . lang('Database') . '<td>', '<input name="auth[db]" value="' . h($_GET["db"]) . '" autocapitalize="off">' . "\n");
                echo "</table>\n";
index 8bcb242e5978a8640ec54c2c3324612272a84cbb..d849c7588710855bb906d1f242afdf3590f92da0 100644 (file)
@@ -152,9 +152,9 @@ function get_driver($id) {
        }
 
        /** Convert operator so it can be used in search
-        * @param string $operator
-        * @return string
-        */
+       * @param string $operator
+       * @return string
+       */
        function convertOperator($operator) {
                return $operator;
        }
index b17745418c86cda6fc427dfb344cc553d8242c46..0795b2a89abb0cace3ba032ead42877ed6f4c851 100644 (file)
@@ -26,8 +26,7 @@ if (!$row) {
 ?>
 
 <form action="" method="post">
-<p><input name="name" id="name" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
-<?php echo script("focus(qs('#name'));"); ?>
+<p><input name="name" autofocus value="<?php echo h($row["name"]); ?>" autocapitalize="off">
 <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php
 if ($_GET["ns"] != "") {
index dbea5ae59449640b263673a185a56f140cf91ac2..4dee070fa835c82c998f606a2907d7450182b32f 100644 (file)
@@ -1,4 +1,5 @@
 Adminer 4.14.0:
+Use autofocus HTML attribute
 PostgreSQL: Fix initial value of exported autoincrement
 PostgreSQL: Fix renaming a database
 
index 58d5fce313d198adc9b3d82b7a00a1984fb9ec5e..0ba034f1db54595cf239e5e1565fce1c561c06d6 100644 (file)
@@ -72,7 +72,7 @@ class Adminer {
 
        function loginForm() {
                echo "<table cellspacing='0' class='layout'>\n";
-               echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input type="hidden" name="auth[driver]" value="server"><input name="auth[username]" id="username" value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("focus(qs('#username'));"));
+               echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input type="hidden" name="auth[driver]" value="server"><input name="auth[username]" autofocus value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">');
                echo $this->loginFormField('password', '<tr><th>' . lang('Password') . '<td>', '<input type="password" name="auth[password]" autocomplete="current-password">' . "\n");
                echo "</table>\n";
                echo "<p><input type='submit' value='" . lang('Login') . "'>\n";