Prepare the Oven and Dish: Preheat your oven to 400°F (200°C). Lightly grease an 8×8-inch baking dish with nonstick spray to prevent sticking and help with easy cleanup.
Slice and Layer Potatoes and Onions: Peel the potatoes and cut them into uniform ¼-inch slices. Slice the onion into thin rings. Arrange the potato slices in the baking dish, overlapping slightly, then layer the onion rings on top. Continue alternating layers of potatoes and onions until all are used, creating a visually appealing stack.
Make the Creamy Cheese Sauce: In a medium saucepan, melt the butter over medium heat. Once melted, whisk in the flour and salt, stirring continuously for about one minute to form a smooth roux without any lumps. Gradually add the room-temperature milk while whisking constantly. Cook the mixture until it thickens enough to coat the back of a spoon, about 3-5 minutes. Remove from heat and stir in the shredded cheddar cheese until completely melted and the sauce is smooth.
Combine and Cover: Pour the rich cheese sauce evenly over the layered potatoes and onions, making sure every slice is coated. Cover the baking dish tightly with aluminum foil to trap steam, which helps soften the potatoes during baking.
Bake Until Tender: Place the covered dish in the preheated oven and bake for approximately 85-90 minutes. The potatoes should be fork-tender and fully cooked through.
Optional Crisp Topping: For a golden, bubbly finish, remove the foil and switch your oven to broil. Broil the scalloped potatoes for 2-4 minutes, keeping a close eye to avoid burning, until the top turns beautifully golden brown.
Season and Serve: Remove from the oven and season with additional salt and freshly ground black pepper to taste. Let the dish rest for a few minutes before serving to allow the sauce to thicken slightly.