Fix error in WidgetAnnotation

Fixes #5417