Heat coconut milk until it starts to simmer. Turn off heat and use while hot.
Mix glutinous rice flour, sugar, and salt. Add hot coconut milk and mix into a soft, smooth dough. It should feel like soft clay. Adjust with more liquid or flour as needed.
Mix in grated coconut, if using.
Roll about 1 tablespoon dough into small balls. Keep them small because they get a little bigger as they fry.
Fry in 2 inches of oil over medium-low heat for about 8 minutes, stirring now and then, until they float. Starting low helps keep them from popping open.
Raise the heat and fry 3 to 5 minutes more, turning and gently pushing them down until evenly browned. Drain.
In a wide pan, add a little frying oil and sugar. Set over medium heat. Once it starts to melt, stir until evenly caramelized.
Add carioca and toss to coat. Transfer to a rack or parchment paper.
Cool slightly, then skewer and serve.