metals that have a low number of occupied shells such as lithium and potassium should have a stronger electrostatic attraction to their nuclei, so what causes them to always lose their electrons during ionic bonding with a non metal?
Potassium is in the 4th period and therefore has at least 4 shells occupied with electrons while lithium is in period 2 and thus only has 2 shells occupied with electrons. Perhaps you mean they both have 1 valence electron that must be ionised before they become a cation? Anyhow, ionic bonds are formed due to the strong electrostatic attraction between oppositely charged ions. All elements would like to achieve a noble gas electron arrangement due to its stability. However, to be able to achieve this, elements must either gain or lose electrons depending on how close their electron arrangement is to their closest noble gas, e.g. Fluorine would like to gain 1 electron while Magnesium is more likely to lose 2 electrons to form its closest noble gas.
For instance, NaCl: Na would like to lose an electron and Cl would like to gain an electron. Together this is possible. The nucleus of the Cl atom electrostatically attracts the valence electron from the Na atom– this attraction is strong enough the overcome the the attraction this valence electron feels from its own nucleus. As a result, the Cl gains a negative charge due to it gaining a negatively charged electron and the Na atom now has a positive charge as it has one less negatively charged electron. The Cl- and Na+ are oppositely charged and therefore attract each other. This is known as ionic bonding and results in the formation of an ionic lattice.
Now to your question. All elements in group 1 have approximately the same effective nuclear charge, i.e. the attraction the valence electrons feel from the nucleus of their atom after the shielding of the inner electrons is considered. Hence, the fact that they are in group 1 should not significantly affect the ability to lose their valence electrons. However, as one goes down periods, the number of occupied outer shells increases, which means that the valence shells experience a weaker attraction from their nucleus. This is confirmed by the lower first ionisation energy trends. To answer your question frankly (I perhaps overcomplicated with my verbose writing style), it is the strong affinity for electrons of the non-metals that result in the loss of the valence electrons from the metals. Even if the the metal has a smaller atomic radius due to occupying less shells, the affinity for the electrons from the non-metals is strong enough to take the metal's valence electrons and make it into a cation.
Pearson Higher Level Chemistry Textbook, 2nd Edition. By Catrin Brown and Mike Ford.