View Single Post
07/13/15, 12:24 PM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
I can reproduce this 100% of the time without any addons & without doing anything special, just clicking on the label & selecting "/tell" does it every time.

It appears that in:
Lua Code:
  1. function SharedChatSystem:ShowTextEntryMenu()
  2.    ...
  3.    if data.target then
  4.       AddMenuItem(switch, function() self:StartTextEntry(switch .. " ") end, nil, nil, itemColor)
  5.    else
  6.       AddMenuItem(switch, function() self:SetChannel(data.id) end, nil, nil, itemColor)
  7.    end
  8.   ...
  9. end

The "/tell" switch is the only one that requires a target & thus the only one that gets added to the menu with:
Lua Code:
  1. AddMenuItem(switch, function() self:StartTextEntry(switch .. " ") end, nil, nil, itemColor)

But since they are not passing the channel to the function:
Lua Code:
  1. function SharedChatSystem:StartTextEntry(text, channel, target)
  2.     if not self.currentChannel or channel then
  3.         self:SetChannel(channel or CHAT_CHANNEL_SAY, target)  
  4.     end
  5.  ...
  6. end
That code never runs & the channel never gets set.

The function:
Lua Code:
  1. function SharedChatSystem:SetChannel(newChannel, channelTarget)
is also the function that assigns focus to the control. Since the channel never gets set for the "/tell" switch, it never gets focus either.

It looks like it should have been:
Lua Code:
  1. function SharedChatSystem:ShowTextEntryMenu()
  2.    ...
  3.    if data.target then
  4.       --==== it should have also passed the channel here (data.id) ====--
  5.       AddMenuItem(switch, function() self:StartTextEntry(switch .. " ", data.id) end, nil, nil, itemColor)
  6.    else
  7.       AddMenuItem(switch, function() self:SetChannel(data.id) end, nil, nil, itemColor)
  8.    end
  9.   ...
  10. end