Preheat the oven to 350°F (180°C). Grease a 9x5-inch loaf pan with butter or nonstick cooking spray and then line the pan with parchment paper, leaving an overhang on all sides. Grease the parchment paper with butter or nonstick cooking spray and then set it aside.
In a small bowl, whisk together the flour, baking powder, baking soda, and salt. Set aside.
In a medium bowl using an electric hand mixer, cream together the butter, dark brown sugar, and granulated sugar until combined and fluffy, about 3 minutes.
Add the egg yolk and vanilla, and mix until incorporated. Add the dry ingredients and mix until just combined. Fold the chopped chocolate into the dough.
Gently press the dough into the prepared pan in an even layer. Bake for 15-18 minutes, or until the top is light golden brown and slightly firm to the touch. (Do not overbake; I even recommend to slightly underbake!) If desired, sprinkle flaky sea salt on top right after the pan comes out of the oven. Allow cookie bars to cool completely in the pan before removing and slicing.
Cover and store leftover bars in an airtight container at room temperature for 2 to 3 days.