day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
797 stars 146 forks source link

scrollable component will scroll to top if autofocus attribute set on input-text #82

Closed benhowell closed 8 years ago

benhowell commented 8 years ago

I have a number of popovers with input-text components which contain "auto-focus" attribute inside a scrollable v-box. When a popover is activated and autofocus fires, the v-box scrolls back to top. If I remove auto-focus the problem goes away.

I've attached a screenshot which may make my explanation a little clearer.

Here's the offending code:

[re-com/input-text
 :width "180px"
 :height "32px"
 :style {:font-size "14px"}
 :model text-val
 :on-change #(reset! text-val %)
 :attr {:auto-focus "autofocus"
        :on-click (handler-fn
                   (.preventDefault event)
                   (.stopPropagation event))}
 :placeholder placeholder]

snapshot1

Gregg8 commented 8 years ago

I was not able to reproduce this, so could you please provide more information. Perhaps a gist?

btw, we normally use {:auto-focus true}.

benhowell commented 8 years ago

Hi, Unfortunately I've since moved away from re-com and don't have the original code on hand from 8 months ago. Seeing no one else has commented in that time and you weren't able to reproduce it, it's probably safe to close this issue. Thanks!

Gregg8 commented 8 years ago

ok, thanks.