I think if you have the system turned off while its docked and not in sleep mode they dont charge, I use to power it off and dock the con's and one day after playing for about 3 hours they said they were low on battery...so ever since then I put it in sleep mode.
Switch docked or not docked, as long as you have the charging cable one, it'll charge the joy con too
Also on handheld, it won't lose battery but instead the switch will lose battery whole the joy con is not affected