InteractableWhenSelected flag on Common Button is not always respected

I think I’ve caught an edge case around the bInteractableWhenSelected on the Common Button that means Selected buttons sometimes can’t be clicked (which is a pain when using CommonListViews, which by default want to Select buttons as you navigate).

The issue is that, depending on the order you set some of the button’s flags, it doesn’t always work.

bInteractableWhenSelected interacts with InteractionEnabled, Selected, and Toggleable like so:

  • In SetIsInteractableWhenSelected, we also check Selected and Toggleable before calling SetInteractionEnabled
  • In SetIsToggleable, we also check Selected and either IteractionEnabled or InteractableWhenSelected before calling SetInteractionEnabled
  • In SetSelectedInternal, we check Toggleable, Interactable and InteractableWhenSelected before calling SetInteractionEnabled
  • In SetIsInteractionEnabled, we check Selected and Toggleable but NOT InteractableWhenSelected before setting InteractionEnabled on the RootButton

I think the fix is as simple as making

770 if (!GetSelected() || bToggleable)

into

770 if (!GetSelected() || bToggleable || bInteractableWhenSelected)

Does that seem correct? Any gotchas I’m missing here?

Steps to Reproduce
If you have a CommonButton widget and do the following operations in order:

  1. Author Togglable=false
  2. Set InteractionEnabled=false in code/bp at runtime
  3. Set Selected=true in code/bp at runtime
  4. Try to set InteractionEnabled=true in code/bp at runtime

Step 4 will currently fail because Selected, untoggleable buttons can’t be made interactable and your button cannot be clicked, regardless of InteractableWhenSelected.

Hi,

Your solution looks good to me, I’ll see about getting that checked in. It seems there may also be an issue with UCommonButtonBase::SetSelectedInternal, which checks IsInteractable() instead of bInteractionEnabled. This whole base class could probably use a bit of cleanup, but we should be able to at least get those fixes in for an upcoming release.

Best,

Cody

Awesome, thanks. Yeah, I think I’d convinced myself that SetSelectedInternal was fine, but haven’t looked through the implications of that IsInteractable call. Will add a comment here if I hit any issues related to it, but otherwise I’m happy to live with this change for now and see what you cook up for the future!