the hat has "invisible" elastic that goes under her chin and behind her ears. She was still able to shake it off her head, and it wound up under her chin. So I sewed a piece of velcro to the inside of the back of her dress and a longer strip of velcro to the back of the hat, and anchored the hat to the dress to keep it upright.
The Pugs universally hate headgear!