textarea - Weird behavior on event (Html.Events.on) -
i'm making "fluid" textarea, resizes it's height according it's content. i'm trying implement this script. have following code: https://ellie-app.com/vjtvm6yrkwa1/4
the issue when increasing, works no problem, when trying decrease height, doesn't work expected.
how reproduce issue:
- the textarea comes default text. if click on textarea, resize it's height content.
- delete half of text or entire text.
- click in textarea again. expected behaivor should resize it's height again,recuding it's height, doesn't. either nothing or reduces height little (making have click lot of times until height ok)
i think it's related virual-dom preventing scrollheight change, cache (performance-wise), it's guess.
what problem?
ps. when trying use other kind of events, "input" or "change", issue occurs.
edit 4/20: ilias on slack channel linked this: https://ellie-app.com/h5x9dc4j9ba1/0 (ellie of pure elm autoexpannding text area)
=====
i doubt it's issue w/ decoders.
notice in js example when textarea content changes 2 things done new height:
-- set textarea..height auto
-- textarea..scrollheight.
without first setting auto
js example, too, exhibits behavior you're seeing in elm example.
now notice sequence of events in elm example:
1-- remove lines of text
2-- click textarea; calculates current height (before setting height auto
)
3-- ... dispatches heightchange
4-- ... dispatches autoheight
, updateheight
old height step 2
thus, again, doubt it's issue w/ decoder. check, see following (quick/dirty) ellie -- toggles height between auto
, calculated height, , you'll see correct height calculated every other click: https://ellie-app.com/wwbdfdvhypa1/0
(aside: elm may coalesce values queued same animation frame, dunno w/o looking @ source, that's still beside point here.)
Comments
Post a Comment