final-form / final-form/final-form-focus

Provide custom focus implementation

Open
#13 3 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
81
Forks
18
PR merge metrics
No merged PRs in 30d

Description

### **feature request**

It would be nice to specify focus implementation. For example to make smooth scroll to element + Npx above it before focusing:

```js
import createDecorator from 'final-form-focus'

const onFocus = input => {
const { top } = getOffset(input);
const scrollTop = top - 50;

window.scrollTo({
top: scrollTop,
behavior: 'smooth',
});

input.focus();
}

const focusOnErrors = createDecorator(null, null, onFocus)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.