autoexpand icon indicating copy to clipboard operation
autoexpand copied to clipboard

allow override of default styles

Open TayKangSheng opened this issue 5 years ago • 1 comments

Thank you for making this elm package! It really saved me a lot of time trying to do an auto expanding text box in elm :)

In my project, I am trying to set overflow-y: hidden on my the autoexpand textarea, but i realized that it is not possible. This is because the custom attributes are prepended in front of the default textareaStyles here. This is an example of what I am trying to do. Note the last line where I am trying to override the overflow style.

AutoExpand.config
    { onInput = UpdateInput
    , padding = 0
    , lineHeight = 24
    , minRows = 1
    , maxRows = 10
    }
    |> AutoExpand.withAttribute (Attr.class "input")
    |> AutoExpand.withAttribute (Attr.style "overflow" "hidden hidden")

I am wondering whether there are any reason why the default styles are applied after the custom styles. If not, and with your blessing, I can put up a PR to swap the order such that the custom attributes comes after the default textareaStyles.

TayKangSheng avatar Dec 01 '20 14:12 TayKangSheng

The reason is that overriding the styles may cause the auto expand to stop working correctly. Why would you want overflow-y: hidden on the textarea? That would cause the overflow content to not be scrollable.

ohanhi avatar Dec 15 '20 13:12 ohanhi