S
S
Sergey Suntsev2018-10-01 16:08:10
React
Sergey Suntsev, 2018-10-01 16:08:10

Why after the event onFocus and onBlur can there be automatic scrolling up?

In the application I use react-matrilal-ui and redux-form.
I would throw off the code, but I can’t even imagine which piece to send, as long as this happens with absolutely any form components. Maybe someone faced such a problem?
Here is an example of ui input

import React, {Component} from 'react'
import TextField from '@material-ui/core/TextField'
import {Field} from "redux-form"

const renderTextField = ({
                           input,
                           defaultValue,
                           label,
                           value,
                           meta: {touched, error},
                           ...custom
                         }) => (
  <TextField
    hinttext={error}
    floatinglabeltext={label}
    errortext={touched && error ? error : ''}
    {...input}
    {...custom}
    label={touched && error ? error : label}
    error={touched && error ? true : false}
    defaultValue={value}
  />
)

class MaterialInput extends Component {
  
  render() {
    const {...props} = this.props
    return <Field {...props} component={renderTextField}/>
  }
}

export default MaterialInput

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-10-01
@GreyCrew

Try calling .preventDefault() on the event

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question