Prepare your workspace and ingredients. Preheat your oven to 350°F (175°C) and line two baking sheets with parchment paper. Toast the coconut in a dry skillet over medium heat until lightly golden (about 3-5 minutes), watching carefully to prevent burning.
Mix the dry ingredients. In a medium bowl, whisk together the flour and salt, then set aside.
Cream the butter and sugar in a large bowl using an electric mixer on medium speed until light and fluffy, about 2-3 minutes. Don’t rush this step—proper creaming creates that melt-in-your-mouth texture.
Add the flavor elements. Beat in the vanilla extract, coconut extract (if using), and egg yolks until fully incorporated and smooth.
Incorporate the dry ingredients by gradually adding the flour mixture to the butter mixture on low speed, mixing just until combined. Overmixing will make tough cookies!
Fold in 3/4 cup of the toasted coconut, reserving the remaining 1/4 cup for garnishing the cookies later.
Shape the cookies by rolling the dough into 1-inch balls (about 1 tablespoon each). Place them 2 inches apart on the prepared baking sheets.
Create the thumbprints by gently pressing your thumb or the back of a rounded teaspoon into the center of each ball, creating a deep indentation. If the edges crack slightly, gently press them back together.
Bake the cookies for 10-12 minutes, until the edges are just beginning to turn golden but the cookies are still pale. Remove from the oven and immediately re-press the indentations if they’ve puffed up.
Make the salted caramel while the cookies cool. In a medium saucepan over medium heat, melt the sugar without stirring (just swirl the pan occasionally) until it turns amber, about 5-7 minutes.
Add the butter to the caramel carefully (it will bubble vigorously!) and whisk until melted. Then slowly pour in the heavy cream while continuing to whisk. Cook for another minute until smooth, then stir in the teaspoon of sea salt.
Let the caramel cool slightly for about 10 minutes, until it thickens but is still pourable.
Fill each cookie indentation with the salted caramel, sprinkle with the reserved toasted coconut, and add a tiny pinch of flaky sea salt on top if desired.
Allow the caramel to set for at least 30 minutes before serving or storing the cookies.