Nothing is more disappointing than caramel that falls short of the buttery soft yet firm consistency you dreamt of for your shortbread. If you're facing issues with yours, then it's most likely down to how much you cooked it. If you didn't cook it enough then you'll be left with caramel which is way too soft. When cooked too much or too hard you'll end up with a caramel that cools down to a consistency that leaves you worried about breaking a tooth.
As the caramel hardens as it cools, it's tricky to know if you've got it just right when you remove it from the heat. Therefore, you need to rely on visual cues to know when it is done. It should turn a deep golden, caramelised colour. You can also set a timer so you know when you are roughly in the right area. It should take 20 minutes over medium heat. Keep it at a consistent low boil - with just a few bubbles rising to the surface.
Don't be tempted to wander off to check your phone or make a cup of tea while making the caramel either. You need to stir it constantly to make sure it doesn't stick to the bottom of the pan.