final-form / final-form-focus

🏁 Final Form "decorator" that will attempt to apply focus to the first field with an error upon an attempted form submission
MIT License
83 stars 15 forks source link

Custom focus implementation #25

Open TheRusskiy opened 3 years ago

TheRusskiy commented 3 years ago

Addresses https://github.com/final-form/final-form-focus/issues/13

Example usage:

const focus = (input) => {
  input.focus({ preventScroll: true })
  if (input.scrollIntoView) {
    input.scrollIntoView({
      behavior: 'smooth',
      block: 'center',
    })  
  }
}
createDecorator(undefined, undefined, focus)
codecov[bot] commented 3 years ago

Codecov Report

Merging #25 (48f7dfb) into master (c26b46e) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #25   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         6    +1     
  Lines           44        48    +4     
  Branches        11        12    +1     
=========================================
+ Hits            44        48    +4     
Impacted Files Coverage Δ
src/decorator.js 100.00% <100.00%> (ø)
src/focusInput.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c26b46e...48f7dfb. Read the comment docs.

ricmello commented 2 years ago

Hey guys! Any chances of getting this PR merged?