Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useTransition: the "transitioned" option and elements that begin "visible" #119

Open
weaverryan opened this issue Mar 8, 2021 · 2 comments
Milestone

Comments

@weaverryan
Copy link
Contributor

Hi again!

I've noticed what is, probably, just a missing spot in the docs for the new useTransition.

Suppose that you have an element that starts in a visible state (unlike a drop-down, which is hidden and only shown later):

<div data-controller="custom-close">
    <div data-custom-close-target="boxToClose">
        This element will fade out and in!
    </div>

    <button data-action="custom-close#leave">Close Box</button>
    <button data-action="custom-close#enter">Open Box</button>
</div>

(where the element option is set to this.boxToCloseTarget).

With this setup, on load, the boxToClose element is immediately hidden. Is that expected? What I mean is, if your element begins visible, it is required to pass the transitioned: true option when initializing useTransition (and so, this is something that just needs a mention in the docs)? Or is this not the expected behavior.

Thanks!

@adrienpoly
Copy link
Contributor

you are right it is also missing the ability to set this option from the html

<div data-controller="custom-close" data-custom-close-transitioned-value="true">
    <div data-custom-close-target="boxToClose">
        This element will fade out and in!
    </div>

    <button data-action="custom-close#leave">Close Box</button>
    <button data-action="custom-close#enter">Open Box</button>
</div>

Still wondering about the naming. maybe initialState with enter | leave options would be better?

@weaverryan
Copy link
Contributor Author

It's a bit of a longer name, but I do like initialState 👍

@adrienpoly adrienpoly added this to the v1.0.0 milestone Apr 13, 2021
@marcoroth marcoroth changed the title useTransition: the "transitioned" option and elements that begin "visible" useTransition: the "transitioned" option and elements that begin "visible" Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants