Skip to content

Commit

Permalink
add autofocus in auth form
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-convertino committed Jan 26, 2024
1 parent 9347650 commit ce1819c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This way, the migration from Google Authenticator to OTP Manager will be quick a
* [Official iOS App](https://apps.apple.com/us/app/nextcloud-otp-manager/id6471510170)
]]>
</description>
<version>0.3.4</version>
<version>0.3.5</version>
<licence>agpl</licence>
<author mail="[email protected]" homepage="https://www.convertino.cloud">Matteo Convertino</author>
<namespace>OtpManager</namespace>
Expand Down
4 changes: 2 additions & 2 deletions js/otpmanager-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/otpmanager-main.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/js/utils/PasswordForm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useDisclosure } from "@mantine/hooks";
import React, { useState } from "react";
import React, { useState, useCallback } from "react";

import {
Box,
Expand Down Expand Up @@ -54,6 +54,7 @@ function getStrength(password) {
export default function PasswordForm({ exists, onSubmit, isChanging }) {
const [popoverOpened, setPopoverOpened] = useState(false);
const [visible, { toggle }] = useDisclosure(false);
const autoFocus = useCallback((inputElement) => inputElement && inputElement.focus(), []);

const form = useForm({
initialValues: {
Expand Down Expand Up @@ -119,6 +120,7 @@ export default function PasswordForm({ exists, onSubmit, isChanging }) {
}
visible={visible}
onVisibilityChange={toggle}
ref={autoFocus}
{...form.getInputProps("password")}
/>
</Box>
Expand Down

0 comments on commit ce1819c

Please sign in to comment.