Make frames closable with the Escape key

To make a frame close when the user presses the ESC (Escape) key, add its name to the  table: tinsert(UISpecialFrames, frame:GetName) Note that in order for this to work, your frame must have a name.

Example
The following XML snippet creates a frame that is closable by pressing Escape, and plays the sounds played when you open/close FrameXML panels (e.g. character frame).        tinsert(UISpecialFrames, self:GetName);   PlaySound("igCharacterInfoOpen");   PlaySound("igCharacterInfoClose");   

EditBoxes and OnEscapePressed
EditBox widgets that have focus will handle the Escape key being pressed by firing their own OnEscapePressed widget handler, preventing your frame from being closed while an edit box has focus. You may set your own OnEscapePressed handler on your edit boxes to hide a frame if necessary: editBox:SetScript("OnEscapePressed", function(self) self:GetParent:Hide end)