Why are names that begin with "Mc" first in order over names that begin with "Ma"?

Why is it that in lists of people’s names, surnames beginning with Mc are listed before surnames beginning with Ma?

For example, if a book had a bibliography listing its references, we would see that McGann, Anthony listed first and Maddox, Graham second, like this:

References

  1. McGann, Anthony ...
  2. Maddox, Graham ...

Why doesn’t the ‹a› in McGann come before the ‹d› in Maddox here? Does capitalization matter?

Even when you search Wikipedia, their pop-up is ordered strangely when you start typing in the search box and get as far as “ian mac”:

wikipedia popup for "ian mac" search

That order is not what I would expect. Why do they do that? Also, how come they showed me Ian McKellan and Ian McShane and such when those don’t start with the same letters as those I searched for when I typed “ian mac”?

Does this happen with other names more or less like those as well, making names like these appear in a surprising order as well?

  1. May, Julian
  2. Mbombela, Frederica
  3. McBride, Martina
  4. Mabrey, Sunny
  5. Macaluso, Luigi
  6. Magellan, Ferdinand
  7. MacGill, James
  8. Mack, Sennett
  9. McGill, Jason
  10. McKinley, William
  11. Mackerel, Jack
  12. Machado, Antonio
  13. Machiavelli, Niccolò
  14. Ma, Yo-Yo

Solution 1:

The usual convention in the UK, in telephone directories etc is that Scottish surnames starting Mc are, for alphabetical purposes, treated as though there were an invisible a, between the M and the c. Thus our own telephone directory proceeds as McDonald, J.A., MacDonald J.C., McDonald J.M., MacDonald K. etc.

Solution 2:

Most likely, it is because of treating Mc and Mac as identical.

Naturally then, Mac occurs before Maddox.

It's as such not a sorting issue but a lexical one.