ButtonedElement is an abstract class and is used as a mixin in both ButtonOptionWidget and ButtonWidget. Flags really pertain to FlaggableElement, which is also an abstract class which is mixed into both ButtonOptionWidget and ButtonWidget. The logic for applying the 'secondary' class should be in FlaggableElement, specifically the setFlags method.