This is my code it successfully allows me to left click target but no successful right click menu, It just does nothing with right click.
Code:
local frame1 = CreateFrame("BUTTON", "MyParty1", UIParent, "SecureUnitButtonTemplate")
frame1:SetSize(200, 40)
frame1:SetBackdrop({ bgFile = "Interface\\BUTTONS\\WHITE8X8", tile = true, tileSize = 8 })
frame1:SetBackdropColor(0, 0, 0)
frame1:SetMovable(true)
frame1:ClearAllPoints()
frame1:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
frame1:SetUserPlaced(true)
frame1:SetMovable(false)
frame1:EnableMouse(true)
frame1:RegisterForClicks("LeftButtonUp", "RightButtonUp")
frame1:SetAttribute('unit', 'party1')
RegisterUnitWatch(frame1)
frame1:SetAttribute('*type1', 'target')
frame1:SetAttribute('*type2', 'togglemenu')