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

Dismiss duration doesn't apply to transition. #924

Open
gabrielso opened this issue Jul 11, 2024 · 1 comment
Open

Dismiss duration doesn't apply to transition. #924

gabrielso opened this issue Jul 11, 2024 · 1 comment

Comments

@gabrielso
Copy link

Describe the bug
When I set up a Dismiss object with the following options:

<div id="dismissMe">
  <p> Dismiss me! </p>
  <span id="dismissTrigger"> [X] </span>
</div>

<script>
  let dismiss = new Dismiss(document.querySelector("#dismissMe"), null, { duration: 10000 });
  document.querySelector("#dismissTrigger").addEventListener("click", (e) => { dismiss.hide() });
</script>

I expect that when clicking "[X]" the dismiss transition (default "transition-opacity") to follow the duration, the #dismissMe element opacity should slowly disappear, taking 10s to change from 1 to 0.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a Dismiss with the duration option set to 10000
  2. Trigger the .hide() function
  3. Note that the transition-opacity for the target element goes from 1 to 0 fast (assuming 300ms)
  4. Note that the target element block space is still present on the page for the remaining duration.
  5. After 10s (the duration option) the element is removed from the page, the block space previously occupied by the target element is removed.

Expected behavior
I expect the transition to follow the duration option, the element opacity should slowly decrease in the 10s duration as set in the example.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Version: 126
@gabrielso
Copy link
Author

gabrielso commented Jul 11, 2024

I assume the duration option must be one of the presets defined by Tailwind? If that's the case the documentation leaves much to be desired. I can submit a PR to add this note if that's the case.

However, even if I try to generate a custom duration in tailwind.config.js it doesn't work:

module.exports = {
  // ...
  theme: {
    extend: {
      transitionDuration: {
        '10000': '10s', // or '10000ms'
      }
    }
  }
}

I would like to be able to set custom durations and having them be applied regardless of Tailwind. Does that make sense?

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

1 participant