Shadcn ui dialog is BROKEN! .. Let's fix it! 🔨

Поделиться
HTML-код
  • Опубликовано: 9 янв 2025

Комментарии • 70

  • @WebDevEducation
    @WebDevEducation  7 месяцев назад +11

    NOTE: You also need to add a class of "relative" to the DialogPrimitive.Content component to ensure the close / X button renders correctly within the dialog.

    • @mamiraame
      @mamiraame 3 месяца назад

      thanks buddy

    • @gtkall
      @gtkall 3 месяца назад

      thanks for the info, but PLEASE pin your comment.

    • @kazz94
      @kazz94 3 месяца назад

      I was about to comment this. Maybe you can add a note in the video, this is very helpful. Thank you for the help!

  • @TheTmLev
    @TheTmLev 7 месяцев назад +35

    I think this shows how important it is to know how libraries and tools you use work under the hood. shadcn/ui is mostly just a wrapper around Radix UI. And Radix UI has explicitly stated in their docs how to make Dialog's content scrollable. It shouldn't be "something that shadcn/ui needs to fix", it's the default behaviour of Radix UI with a suggested way to make Dialog scrollable. So "read the docs", I guess?..

    • @WebDevEducation
      @WebDevEducation  7 месяцев назад +7

      Good point. Altho just using Radix UI's method alone doesn't actually make the shadcn one scrollable. You still need to do the extra steps. Either way, who has time to find the answer in the docs in 5 mins when they can spend 2 hours pulling their hair out?

    • @jakezamora-y5n
      @jakezamora-y5n 7 месяцев назад +1

      Maybe learn html and css? It's a basic mistake hahaha

  • @dragonloboJR
    @dragonloboJR 5 месяцев назад +1

    The first time I saw this video I knew it would be useful to me in the future, 2 months later i'm here, thank you!

  • @jakezamora-y5n
    @jakezamora-y5n 7 месяцев назад +5

    To prevent the animation from breaking, do not remove the attributes "left-[50%] top-[50%]" and "translate-x-[-50%] translate-y-[-50%]", just change the "fixed" attribute for "absolute", that will make everything work well without really breaking.
    sorry for my english, i use google transalte.

  • @MohamedElguarir
    @MohamedElguarir 7 месяцев назад +7

    you don't need all that, you can just add a max-h-[85dvh] overflow-y-auto to the primitive.content and you're done.

    • @WebDevEducation
      @WebDevEducation  7 месяцев назад +2

      I'm not a big fan of that approach because it means the content is scrollable rather than the actual dialog. Also scrolling will only work when triggered inside the content area rather than from anywhere on the screen.

    • @WebDevEducation
      @WebDevEducation  7 месяцев назад +1

      All comes down to personal preference tho. The method outlined in the video is my preference.

    • @MohamedElguarir
      @MohamedElguarir 7 месяцев назад

      @@WebDevEducation fair enough 🙏

    • @haiffy
      @haiffy 7 месяцев назад +1

      thank you, i like this approach much better

  • @syth-1
    @syth-1 7 месяцев назад

    Interesting to see how others have fixed this issue, this was one of the first things i had fixed starting my web dev adventures, brings back nostalgia for sure, thanks for sharing!

  • @kelvindimson
    @kelvindimson 7 месяцев назад

    You are amazing… I did this last week and i nearly ran mad!

  • @AndrewKaiser-gw4ts
    @AndrewKaiser-gw4ts 7 месяцев назад

    Good to know. Was just trying to deal with this. Had to sort out that max width first...

  • @CodeZakk
    @CodeZakk 7 месяцев назад +3

    also the datepicker component has some problems. when I create a calender it gives it doesn't give me year and month select. it is a big issue that's why I use another frameworks!

    • @WebDevEducation
      @WebDevEducation  7 месяцев назад +2

      I also created a video on the shadcn ui calendar:
      ruclips.net/video/cY5RMVj2GtU/видео.html

  • @nixonmbeki5690
    @nixonmbeki5690 5 месяцев назад

    You're the giants we stand on. Thank you.

    • @WebDevEducation
      @WebDevEducation  4 месяца назад +1

      I can't take credit for the fix but happy that I was able to share it with people who may otherwise not have seen it 🙏

  • @KaranSethia24
    @KaranSethia24 4 месяца назад

    Dude, Im just straight up bookmarking this. It was driving me crazy, this is specially annoying when you're using a select or command component inside a dialog. This and the pointer-events: none in the body that radix ui does is so annoying

  • @anonymousftw6386
    @anonymousftw6386 7 месяцев назад

    Need a video on how to contribute to this libraries from scratch

  • @usmanmughal5916
    @usmanmughal5916 4 месяца назад

    Please also address the issue where on mobile screen when we open the keyboard to type half of the dialogue hides behind the keyboard

  • @vpetryniak
    @vpetryniak 4 месяца назад

    What if you have horizontal small width? I also tried to fix horizontal bu cannot make it work correctly with cross close button icon

  • @יהוידעשטינמץ
    @יהוידעשטינמץ 7 месяцев назад

    Thanks, I acctualy need this fix!

  • @UwU-dx5hu
    @UwU-dx5hu Месяц назад

    Thank you so much. you saved my time. thank you

  • @brian-mcbride
    @brian-mcbride 4 месяца назад

    One has to wonder why the ShadCN UI isn't updated properly.
    I'm starting to avoid using it and instead applying DaisyUI styles to Radix directly.

  • @LucasSantos-cf6nz
    @LucasSantos-cf6nz 5 месяцев назад

    Are you getting states errors in the browser console when using inputs inside the modal?

  • @letmewatch.
    @letmewatch. 7 месяцев назад

    do you have a fix for components like Sheet and Toast having transparent background?

  • @SajidMunawar-u3w
    @SajidMunawar-u3w 7 месяцев назад

    thank you so much sir for making videos and helping community.

  • @antares-the-one
    @antares-the-one 7 месяцев назад

    do you know a way how to deal with overflowing submenu in dropdown? on mobile, vertical orientation, dropdown takes almost all width and submenu oppens at the side so it is mostly clipped

  • @nemanjadjurdjevic6380
    @nemanjadjurdjevic6380 5 месяцев назад

    You saved my life, thank you!

  • @zancrow_gaming
    @zancrow_gaming 6 месяцев назад +1

    i did max-h-[90vh] overflow-y-auto on the dialogContent, and its fixed. no need to move this or that.

    • @WebDevEducation
      @WebDevEducation  6 месяцев назад +1

      That's one solution but doesn't produce the result shown in the video, which is the one I needed.

  • @vpetryniak
    @vpetryniak 4 месяца назад

    There is still abug in your implementation. Cross button i snot displayed correctly

    • @WebDevEducation
      @WebDevEducation  4 месяца назад +2

      I already highlighted this in a comment when I posted the video:
      "NOTE: You also need to add a class of "relative" to the DialogPrimitive.Content component to ensure the close / X button renders correctly within the dialog."

  • @cassianpry
    @cassianpry 2 месяца назад

    Saved me!! Thank you

  • @falasefemi3344
    @falasefemi3344 7 месяцев назад

    Thanks for this. I have to follow your page. Thanks

  • @aac487
    @aac487 Месяц назад

    i wasted two days then thought there is you tube not just chatgpt

  • @ИванАрабаджийски
    @ИванАрабаджийски 7 месяцев назад

    I think the same problem is present for the drop down menu

    • @antares-the-one
      @antares-the-one 7 месяцев назад

      not the same. There is no overlay for dropdown. There is a popper. I wish someone would show a way to scroll a dropdown on overflow or position it differently

  • @andreiflorianbratila6916
    @andreiflorianbratila6916 2 месяца назад

    i find a better solution, i put forms in the dialog so i put this : ' z-50 max-h-[90vh] overflow-auto in dialog content and this 'fixed py-10 grid place-items-center in dialog overlay

  • @k.k.2124
    @k.k.2124 2 месяца назад

    Thank you so much!

  • @wepranaga
    @wepranaga 7 месяцев назад +1

    bro just make a PR

  • @nickmandylas
    @nickmandylas Месяц назад

    Thank you 🙏

  • @mohammadDeveloper2431
    @mohammadDeveloper2431 3 месяца назад

    thank you sir

  • @claudiotormen759
    @claudiotormen759 6 месяцев назад

    Thank you

  • @leon_meka
    @leon_meka 7 месяцев назад

    max-hans 🙏

  • @reilwaystation4372
    @reilwaystation4372 Месяц назад

    shadcn have abusive relationship with relative and absolute lol

  • @hooyah
    @hooyah 2 месяца назад

    thanks.

  • @snatvb
    @snatvb 6 месяцев назад

    🙏🙏

  • @alyxx997
    @alyxx997 7 месяцев назад

    havent seen your other videos but if figuring out some of most basic css properties on this component to ”fix” it took ”ages”, i wouldnt wanna learn from you.

    • @WebDevEducation
      @WebDevEducation  7 месяцев назад +3

      Then don't :)

    • @NewAwesomeTech
      @NewAwesomeTech 7 месяцев назад +1

      You don't have to be rude about it @alyxx997. Sometimes the most basic things, are the most difficult to resolve quickly.

  • @ayo.bakare
    @ayo.bakare 7 месяцев назад

    Nothing is broken then!!🤔 Click bait😒