Wireless keyboard stops working when charging batteries

I have issue with batteries on iMac 2015. Once I charge batteries, my wireless keyboard would not connect. It starts working as soon as I plug out the batteries. What might be causing this? Laptop is new.

  1. Make sure that your keyboard is turned on. If you have a Magic Keyboard or Magic Keyboard with Numeric Keypad, slide the power switch on the back of the keyboard to turn it on (green is visible when the keyboard is on). If you have an Apple Wireless Keyboard (late 2015 or earlier), press the power button on the right side of the keyboard. The green LED on the upper right side of the keyboard briefly lights up.

  2. Verify that the keyboard is connected by pressing the Caps Lock key. If the keyboard is connected to your system, the Caps Lock light turns on when you press it.

  3. Read about setting up your Apple wireless devices to make sure that the device is set up correctly.

  4. Make sure that your keyboard has power. Check the battery level in the Bluetooth menu Bluetooth at the top of your screen. If power is low, recharge your Magic Keyboard or Magic Keyboard with Numeric Keypad, or replace the batteries in your Apple Wireless Keyboard.

  5. Check the keys by typing in an app like Notes

If your keyboard doesn’t work over Bluetooth after trying these steps, it might a game over and need a new one.