Calculating default active-tab based on priorities.