While uploading keys to capsule sort by name not arranging keys in alphabetical order
The data of portals from keys in the inventory or when opening a capsule containing keys is not always completely loaded.
You can easily see that when looking at keys in a capsule. Hor some portals, you will have to wait to get its level and the resonators.
It seems the location (coordinates) of a portal is always accessible from the key in the scanner and does not need to be loaded from the backend, so the scanner can always calculate the distance from it and the sort by distance is accurate.
But the names of portals need to be loaded from the backend. And it's not automatic, you have to manually trigger it by looking at the key in your inventory or the capsule.
While all the name are not loaded, the scanner can't sort correctly by name because some names are not available yet.
But the sort is re calculated each time you leave the capsule then open it again (also maybe when you add or remove keys from it?). In the inventory, it's the same thing when you leave the keys list then go back to it, going to the item inventory for example, or looking at details for a portal from a key.
So if you want the sort by name to be correct, you first need to display all keys and be sure the name and other data are loaded from the backend.
If you have already choose the name sort before loading all the data, you may have to change it to sort by distance, then back again to sort by name.