dcastil/tailwind-merge

Display class not being removed when it precedes `line-clamp-*`

Closed this issue · 2 comments

Aleuck commented

Describe the bug

The line-clamp-* depends on having display set to -webkit-box or -webkit-inline-box. Tailwind line-clamp-* sets display: -webkit-box.

Therefore there is no point in keeping other basic display classes like inline, block or inline-block when there is a line-clamp-* afterwards.

However, twMerge keeps Display classes when they are followed by a line clamp class.

To Reproduce

> twMerge('inline-block', 'line-clamp-1')
'inline-block line-clamp-1'
> twMerge('inline', 'line-clamp-2')
'inline line-clamp-2'
> twMerge('block', 'line-clamp-2')
'block line-clamp-2'

Expected behavior

> twMerge('inline-block', 'line-clamp-1')
'line-clamp-1'
> twMerge('inline', 'line-clamp-2')
'line-clamp-2'
> twMerge('block', 'line-clamp-2')
'line-clamp-2'

Environment

  • tailwind-merge version: 2.0.0

Hey @Aleuck! 👋

You're right. Tailwind also sets overflow: hidden in the line-clamp classes, so overflow classes should be removed, too. I'll fix this in the coming days.

This was addressed in release v2.1.0.