Right Trigger Fires MouseButton1 ContextActionService Handlers

Reproduction

  1. Copy and paste the following code into a LocalScript in StarterPlayerScripts:
game:GetService("ContextActionService"):BindAction("MouseButton", function(_, input_state, input_object)
	print(input_state, input_object.UserInputType)
	return Enum.ContextActionResult.Pass
end, false, Enum.UserInputType.MouseButton1)
  1. Run the game with a controller and pull the right trigger.

ReproFile.rbxl (41.2 KB)

Expected Behavior

Pulling the right trigger should do nothing, as no handlers are assigned to listen for it.

Actual Behavior

Pulling the right trigger invokes the bound handler listening for MouseButton1 input.

Only ContextActionService is affected. UserInputService will not fire any events with mouse-related InputObjects, nor will UserInputService.LastInputTypeChanged fire.

Workaround

Binding a sinking input handler that processes either Enum.UserInputType.Gamepad1 or Enum.KeyCode.ButtonR2 at a higher priority will prevent the MouseButton1 handler from running.

Other Information

Bug experienced using a wired Microsoft XBox 360 controller on Windows 10.

Issue Area: Engine
Issue Type: Input
Impact: Low
Frequency: Constantly
Date First Experienced: 2023-05-03 13:00:00 (-04:00)

1 Like

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!

1 Like

Gamepad RT is the equivalent to MouseButton1, which we don’t let developers deactivate for security access reasons. E.g. on consoles this is needed to work with the core UI.
Do you have an example of how this causes issues for your workflow?

The only issue that can’t be easily circumvented is if whatever is bound to the trigger cannot sink its input. In that case, the best approach seems to be to ensure that gamepad input processes first, then set a flag for that resumption cycle to ignore mouse button input.

Mostly what I was thrown off by was the inconsistency in behavior between ContextActionService and UserInputService, since only CAS responds in this way.