When we built the deck, we didn't bother with a deck gate, although our deck sits 1.5 stories off the ground. My main concern was that small children could fall down a long flight of stairs. So I designed the deck with a series of gradual step downs to prevent a disastrous fall. The top deck features three steps and a walkway that wraps around the front of the deck; another three steps down to a platform deck, and then three wide open wraparound steps to the grass. See? No steep stairs, no falls.

What I didn't plan for was having a child who wanders away at will. Nub has Down Syndrome, but he's only 5 years old, so he's functionally more like a 2 year old. Explaining that we want him to stay on the deck doesn't do much good, unless it was his idea. Of course now that the back yard gates are fixed, a large portion of the danger is taken care of. Still, there are days when you just want the toddlers to stay on the top deck within sight while you take care of things inside.
I've been puzzling over how to build a deck gate for a couple of weeks. The stair opening is wide enough, but the depth of the wraparound stairs is fairly narrow, so there isn't room for a gate that swings outward. We could put an inward swinging gate, except for that big black pole of the gazebo bolted to the deck is in the way.
Then I hit upon the idea of a sliding gate. I tried a couple of prototypes with some scrap lumber, some caster wheels, and a dozen types of brackets. Each approach had some unforeseen "gotcha" that kept me from completing it. Having a sliding gate that needs to be held up at the top and the bottom without hitting the supports is a real challenge.
My epiphany hit when I was gazing at the deck rails. I discovered I could turn them upside down and the railings hung just low enough to hold the top of my deck gate rail in -- making it a guide rail. I then screwed a long 1"x1" guide rail to the deck floor to hold the bottom of the gate from sliding out. I was pretty pleased with my little discovery.
The deck gate itself is a pre-fab deck railing. It sits on the deck surface and slides fairly smoothly without the need for any casters or wheels. Since it is largely the same style as our current deck, it isn't too jarring to look at. Once it is stained along with the rest of the deck, the aesthetics will be complete. Now I just need a handle and a latch and I'm all done.The hard part, honestly, was the thinking the problem through and not the labor. So while I don't think Bob Villa's job is in any jeopardy, I'm pretty happy with my little gate.