Add olive oil to a skillet and over medium-low heat. Add onions and stir them until coated with oil. Cook until tender and translucent, 15 to 20 minutes.
Stir in the sugar until it's dissolved. Add the bay leaf. Continue cooking, string occasionally, over low heat until the onions are caramelized, 10 to 15 minutes.
Store the confit in the fridge in its oil. It will keep up to 1 month if stored properly. Add this onion jam to your favorite dishes, and you won’t have to worry about storing it because it will be gone much sooner than that.