tailwindlabs / tailwindui-issues

Bug fixes and feature request tracking for Tailwind UI.
233 stars 4 forks source link

Component Renders Differently Using Mobile Browser and Desktop Browser with Same Resolution (Chrome devtools or via Resizing) #1621

Closed JiayiLiuCA closed 3 weeks ago

JiayiLiuCA commented 3 weeks ago

What component (if applicable)

Describe the bug Component Renders Differently Using Mobile Browser and Desktop Browser with Same Resolution (Chrome devtools or via Resizing)

To Reproduce Steps to reproduce the behavior: (Each step with screenshots)

  1. Go to component webpage with a desktop browser and resize it to minimum width allowed.
  2. Go to component webpage with a mobile browser (Chrome/Safari) and check the component.

Expected behavior They should look identical or very similar since the resolution is slightly different.

Screenshots desktop1 iphone1 desktop2 iphone2

Browser/Device (if applicable)

Additional context It might be a line of CSS not working. Could be "left-1/2 -translate-x-1/2"

adamwathan commented 3 weeks ago

Ah thanks for catching this, solution is move min-w-max up one element in the tree to the containing element for all the images:

- <div class="absolute -top-32 left-1/2 -translate-x-1/2 transform sm:top-6 sm:translate-x-0">
+ <div class="absolute -top-32 left-1/2 min-w-max -translate-x-1/2 transform sm:top-6 sm:translate-x-0">
-     <div class="ml-24 flex min-w-max space-x-6 sm:ml-3 lg:space-x-8">
+     <div class="ml-24 flex space-x-6 sm:ml-3 lg:space-x-8">
        <div class="flex space-x-6 sm:flex-col sm:space-x-0 sm:space-y-6 lg:space-y-8">

Pushing an updated version now 👍

reinink commented 3 weeks ago

@JiayiLiuCA Hey thanks again for bringing this to our attention. We've just deployed a fix for this to the Tailwind UI website 🤙