daisyui icon indicating copy to clipboard operation
daisyui copied to clipboard

bug: timeline can't work with media variants

Open withden opened this issue 10 months ago โ€ข 3 comments

Reproduction URL (Required)

https://play.tailwindcss.com/ffzjEZtHvV

What version of daisyUI are you using?

5.0.28

Which browsers are you seeing the problem on?

No response

Describe your issue

Hey,

When we use any media variants with timeline-start or timeline-end (Ex, md:timeline-start timeline-end), it will not work as expected.

withden avatar Apr 28 '25 11:04 withden

Thank you @withden for reporting issues. It helps daisyUI a lot ๐Ÿ’š
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

github-actions[bot] avatar Apr 28 '25 11:04 github-actions[bot]

Adding some info here, hope it will help correct the issue faster.

The issue is that timeline rely on CSS selectors to find timeline-middle in its children and take decisions based on that. If we use something like lg:timeline-middle, then it no longer work as the child class no longer has timeline-middle but lg:timeline-middle, which is not matched by the selector.

The problem is a lot worse for when using timeline-compact because not only does it rely on finding timeline-start but it also attempt to re-write it, as well as timeline-end. Again, using any Tailwind modifier completely breaks the behavior.

crypto7world avatar May 18 '25 16:05 crypto7world

I'm not sure if there's an efficient way to solve this. as @crypto7world mentioned, we need to check for the existence of class name but if the class name is not (for example) timeline-start anymore and instead it's md:timeline-start, it's challenging to identify it.

saadeghi avatar May 30 '25 19:05 saadeghi

This is not going to work because it would require changing the HTML structure:

  • timeline
    • <li>
      • <hr>
      • timeline-start
      • timeline-middle
      • timeline-end
      • <hr>

They are all optional, but we can't swap places of timeline-start and timeline-end parts in DOM with CSS. They are "parts" of the component, not modifier class names, so it is expected for them to be in this order: start, middle, end.

You can hide them conditionally tho. Example: https://play.tailwindcss.com/F6QibDfD2I?size=1074x273

saadeghi avatar Nov 13 '25 12:11 saadeghi