Let's Have a Dialog about Dialogs!

  Рет қаралды 6,370

Laracasts

Laracasts

Күн бұрын

Пікірлер: 26
@Laracastsofficial
@Laracastsofficial 5 ай бұрын
A couple of things to consider, that we didn't cover in the video. 1. CSS positioning can sometimes get tricky if you place a dialog deeply nested in the DOM. It's common to place modals at the end of the page, just before the closing body tag. If you're using Vue or React, research portals/teleports. 2. If you want a fancy hide animation (like sliding down), you may run into an issue where the "hide" animation runs immediately when the page loads. There's a couple ways to deal with this, but the most popular is to toggle a "disable-animations" class on your body tag. This class should disable any running animations. .disable-animations { animation-duration: 0s; /* ... */ } Alternatively, you can use @starting-style for your transitions. At the time of this writing, it only works in Google Chrome, but I'm sure more browser support is coming soon. Here's an example you can review: codepen.io/jeffreylaracasts/pen/pomyVoy
@Munja12
@Munja12 3 ай бұрын
Here's how I animated backdrop: .backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: 5; backdrop-filter: blur(2px); animation: anim .2s; animation-fill-mode: forwards; } @keyframes anim { 0% { background: rgba(0, 0, 0, 0.01); backdrop-filter: blur(0px); } 100% { background: rgba(79, 69, 126, 0.8); backdrop-filter: blur(4px); } }
@3mro_coding
@3mro_coding 5 ай бұрын
You are naturally born as a teacher. The way you simplify the process is really simple. Thanks for sharing and teaching while you are learning.
@ihorrud5088
@ihorrud5088 2 ай бұрын
Thanks, Jeffrey for the video. By far the best solution for modals IMO
@jeffreyway520
@jeffreyway520 6 ай бұрын
Heads up, a 4k version is still transcoding. Should be available shortly.
@Richardritchie-w1f
@Richardritchie-w1f 6 ай бұрын
❤ You are my favorite teacher ever. You are representing laravel in the best way ever. Thank you so much for your work. I guess laravel gaining in weight by your presence, and not opposite xD. See ya soon on Laracasts. ❤
@drujas
@drujas 6 ай бұрын
Jeffrey Por que no utilizas el logo de la "A" de laracAsts como el avatar de tu canal en KZbin, se vería genial, y seria mas fácil distinguir tu contenido del montón. Ya que ahora abunda la cantidad y hay que saber distinguir la calidad. Buen video, saludos desde Bolivia...
@kamaladeyinka40
@kamaladeyinka40 6 ай бұрын
Repo?
@TheThirdWorldCitizen
@TheThirdWorldCitizen 6 ай бұрын
One option for animation/transition and removing ::backdrop, is to simply use a generic container inside the dialog. And add the opacity/visibility properties to the container instead. Some might think this sounds silly, but it’s actually convenient because now the dialog is 100dvh and 100dvw, and using flex or grid, you can position the generic container wherever you want.
@devinegger4570
@devinegger4570 5 ай бұрын
Accessibility is the biggest concern I can think of with setting the dialog to always display: block and controlling the visibility with opacity. With this method the dialog is always rendered to the DOM and visible to assistive devices - which will relay the content to the user without context and likely be confusing. Something that I have done to overcome this is create a tiny helper function that opens the dialog, and then afterwards set a class that will apply the transitionable state. There's probably issues with this implementation too, as you likely came across this method in your searching. If so, I'd be happy to hear what they are! Thanks for making videos, they're truly excellent!
@simonswiss
@simonswiss 6 ай бұрын
Whoaaaa, I have never used the ::backdrop pseudo-element - always have an 'inset-0' extra div. Awesome! 🙉
@bambamboole1
@bambamboole1 6 ай бұрын
awesome video. I think the way you did the animation is totally fine with a speed of .3 secs. We engineers always want to have it perfect. but thats the enemy of done ;)
@bulent2435
@bulent2435 6 ай бұрын
This is a gem. Thanks.
@zorgo8513
@zorgo8513 6 ай бұрын
Someone else has probably already figured this out but if you always have the dialog set to display block but at 0 opacity you can still tab inside of it and focus elements which is bad for accessibility.
@PlayerRPG85
@PlayerRPG85 6 ай бұрын
I will steal some of this code for sure!
@brunoggdev6305
@brunoggdev6305 6 ай бұрын
That is pretty interesting, now I wanna use that
@floodlitworld
@floodlitworld 6 ай бұрын
There's a million modal components available for various frameworks... I don't get when adding the functionality to the HTML spec, why they didn't look at the features used in 99% of them. Body scroll lock (with position locking) and backdrop & content transitions are absolute must haves. The native way still requires so much hacking there's no reason to move from a custom implementation.
@gsj005
@gsj005 5 ай бұрын
4:10 actually, it submits the form because the button elements, by default, have a type "submit". As that button should close the modal and not submit the form, the proper fix is to set the button's "type" attribute to "button" (i.e., ).
@VinceKronlein
@VinceKronlein 6 ай бұрын
Personally I would have gone with named slots instead of the extra components, other than that, I don't think you missed anything. I was thinking you might get backdrop transitioning if you wrapped the native dialog in a Vue transition? Well done mate. Thanks.
@devmenezes
@devmenezes 6 ай бұрын
Nice wallpaper!
@aungkomin4235
@aungkomin4235 5 ай бұрын
may I know what kind of theme do you use in your phpstorm?
@brunoggdev6305
@brunoggdev6305 6 ай бұрын
How can I get that cool wallpaper?
@aldoyh
@aldoyh 6 ай бұрын
I'd suggest using GSAP, but that's just me 😁
@Stoney_Eagle
@Stoney_Eagle 6 ай бұрын
If I remember correctly the modal has a pseudo selector named backdrop
@williamxsp
@williamxsp 6 ай бұрын
14:44
@floodlitworld
@floodlitworld 6 ай бұрын
You mean the selector that was the focus of the video for over a minute.... that one?
Popping Over with Popovers
31:08
Laracasts
Рет қаралды 2,1 М.
30 Days to Learn Laravel, Ep 29 - Jobs, Tags, TDD, Oh My!
34:46
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 108 МЛН
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 5 МЛН
Everything You Need to Know About Laravel in 30 Minutes
29:15
Laracasts
Рет қаралды 11 М.
Dive Deeper with Actions
12:34
Laracasts
Рет қаралды 5 М.
Laravel Pipelines: Build an Api
8:54
Jordan Dalton
Рет қаралды 24 М.
Str::markdown() is More Powerful Than You Think
11:04
Laracasts
Рет қаралды 3,8 М.
"Smart" design patterns with container queries
15:27
Kevin Powell
Рет қаралды 37 М.
Eloquent's New Chaperone Method
9:57
Laracasts
Рет қаралды 9 М.
Using Generics with PHP
25:55
Laracasts
Рет қаралды 14 М.
CSS-Only Radial Progress Bars Using Conic Gradients
13:53
Laracasts
Рет қаралды 4,1 М.
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН