Depending what a sliding keyboard tray is made of and how it's broken, chances are you can fix it. It's cheaper to make a few repairs than to buy a new desk because the tray breaks. One problem a sliding keyboard tray encounters is broken wheels. Without wheels, it won't slide. While you can't fix the wheels, you can solve the problem. Other problems include broken or cracked wooden trays and bent brackets.
Spread wood glue along the broken or cracked portions of a wooden keyboard tray. Clamp the pieces together. Keep the clamps on the tray until the glue dries, usually between 24 and 36 hours.
Line up the replacement metal bracket on the side of the keyboard tray. The wheel should face outward. Insert the screws into the holds and screw them into place.
Grip the bent metal with a pair of pliers. Slowly straighten out the metal.
Tilt the keyboard tray downward as you slide the wheels into the bars on the desk. Level the tray and put it in the rest of the way.