In a heavy frying pan, heat up the olive oil and add the finely sliced onions - toss around to make sure they all have a coating of oil.
Cover & cook over a gentle heat until they start to color.
Add the salt, pepper, bay leaves & rosemary sprigs & cook for a further 20 to 30 minutes, until the herbs have wilted.
Take off the lid and add the sugar, wine & vinegars.
Bring them to the boil and keep stirring al the time; then lower the heat & simmer for about 20 to 30 minutes until the liquid is all dissolved and the onions are soft & sticky.
You will need to be very vigilant towards the end of the cooking - stirring all the time so the onions do not stick and become burnt and scorched.
Pick out the rosemary & bay leaves and spoon the confit into a clean, dry & sterilized jar
Process in a water bath canner per instructions
Ready to eat after 2 weeks, but better if kept for at least 1-2 months.
Makes one x 300ml jar - the recipe can easily be increased - use a large preserving pan if necessary.