Your Mac is keyboard used for a long time, can leak out of a battery therein. In the worst case is your Computer will not recognize the device then. Often, you can save the keyboard, but still:
Defective replacing the keyboard: The way to the Apple Support
You have purchased the keyboard recently, you can make warranty claims:
For this you need to have the keyboard within the last two years bought. Is the purchase less than a year ago, even the Apple voluntarily given Apple Care Support. With this you can have your keyboard replaced quickly. Apply in both cases to an Apple Store or the customer service.
You have purchased the keyboard along with a Computer and an Apple Care Protection Plan for your Computer complete, this is also for the accessories. Here, too, you should talk to the Support.
Thus, the battery expires in your Mac keyboard, you should not remove it, if you use the keyboard for an extended period of time. How you Mac, the on-screen keyboard open, we will show you in the next tip.