1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

fix: Prevent scroll when focusing

This commit is contained in:
Maksim Eltyshev 2022-12-26 22:51:17 +01:00
parent 0ad9cffb08
commit 26f464eb25
10 changed files with 31 additions and 14 deletions

View file

@ -43,7 +43,9 @@ const BoardMembershipsStep = React.memo(
); );
useEffect(() => { useEffect(() => {
searchField.current.focus(); searchField.current.focus({
preventScroll: true,
});
}, []); }, []);
return ( return (

View file

@ -63,7 +63,9 @@ const AddStep = React.memo(({ onCreate, onClose }) => {
}, [openStep]); }, [openStep]);
useEffect(() => { useEffect(() => {
nameField.current.focus(); nameField.current.focus({
preventScroll: true,
});
}, []); }, []);
useDidUpdate(() => { useDidUpdate(() => {

View file

@ -89,7 +89,9 @@ const LabelsStep = React.memo(
); );
useEffect(() => { useEffect(() => {
searchField.current.focus(); searchField.current.focus({
preventScroll: true,
});
}, []); }, []);
if (step) { if (step) {

View file

@ -61,7 +61,9 @@ const AddStep = React.memo(
); );
useEffect(() => { useEffect(() => {
searchField.current.focus(); searchField.current.focus({
preventScroll: true,
});
}, []); }, []);
if (step) { if (step) {

View file

@ -88,7 +88,9 @@ const UserAddStep = React.memo(
}, [onCreate, data]); }, [onCreate, data]);
useEffect(() => { useEffect(() => {
emailField.current.focus(); emailField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {

View file

@ -90,7 +90,9 @@ const UserEmailEditStep = React.memo(
}, [email, usePasswordConfirmation, onUpdate, onClose, data]); }, [email, usePasswordConfirmation, onUpdate, onClose, data]);
useEffect(() => { useEffect(() => {
emailField.current.focus(); emailField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {

View file

@ -71,7 +71,9 @@ const UserPasswordEditStep = React.memo(
}, [usePasswordConfirmation, onUpdate, data]); }, [usePasswordConfirmation, onUpdate, data]);
useEffect(() => { useEffect(() => {
passwordField.current.focus(); passwordField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {

View file

@ -90,7 +90,9 @@ const UserUsernameEditStep = React.memo(
}, [username, usePasswordConfirmation, onUpdate, onClose, data]); }, [username, usePasswordConfirmation, onUpdate, onClose, data]);
useEffect(() => { useEffect(() => {
usernameField.current.focus(); usernameField.current.focus({
preventScroll: true,
});
}, []); }, []);
useEffect(() => { useEffect(() => {

View file

@ -3,9 +3,10 @@ import { Input as SemanticUIInput } from 'semantic-ui-react';
import InputPassword from './InputPassword'; import InputPassword from './InputPassword';
import InputMask from './InputMask'; import InputMask from './InputMask';
const Input = SemanticUIInput; export default class Input extends SemanticUIInput {
static Password = InputPassword;
Input.Password = InputPassword; static Mask = InputMask;
Input.Mask = InputMask;
export default Input; focus = (options) => this.inputRef.current.focus(options);
}

View file

@ -1,8 +1,8 @@
import InputMask from 'react-input-mask'; import InputMask from 'react-input-mask';
export default class MaskedInput extends InputMask { export default class MaskedInput extends InputMask {
focus() { focus(options) {
this.getInputDOMNode().focus(); this.getInputDOMNode().focus(options);
} }
select() { select() {