[ 3 posts ]

Greg Taylor

  • Username: gtaylormb
  • Joined: Thu May 24, 2012 2:46 pm
  • Posts: 2
  • Offline
  • Profile

Problem with Panel hideOn 'key' event

Post Posted: Thu May 24, 2012 3:06 pm
+0-
I'm trying to set the hideOn attribute in the following way:

Code:
   var panel = new Y.Panel({
           srcNode: '#searchBox'+dailyMealId,
           width  : 800,
           modal  : true, // Make the Panel modal
           centered: true,
           visible: false,
           plugins: [Y.Plugin.Drag],
          
           // The `hideOn` Attribute takes an array of objects with a required
           // `eventName` property, and two optional properties:
           // `node` and `keyCode`.
           hideOn: [
               {eventName: 'key', keyCode: '27'},                 
               {eventName: 'clickoutside'}
           ]      
       });   


The panel correctly hides when I click outside it, but does not seem to listen to the 'key' event when I hit escape. Is my syntax wrong or is there a bug?

Eric Ferraiuolo

YUI Developer

  • Username: ericf
  • Joined: Mon Jan 12, 2009 8:26 pm
  • Posts: 380
  • Location: Boston, MA
  • Twitter: ericf
  • GitHub: ericf
  • Gists: ericf
  • IRC: eric_f
  • YUI Developer
  • Offline
  • Profile

Re: Problem with Panel hideOn 'key' event

Post Posted: Fri May 25, 2012 6:51 am
+0-
Try:

Code:
{
  node: Y.one('doc'),
  eventName: 'key',
  keyCode: 'esc'
}


See: https://github.com/yui/yui3/blob/master ... ide.js#L69

Greg Taylor

  • Username: gtaylormb
  • Joined: Thu May 24, 2012 2:46 pm
  • Posts: 2
  • Offline
  • Profile

Re: Problem with Panel hideOn 'key' event

Post Posted: Fri May 25, 2012 7:35 am
+0-
That worked! Thanks dude.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum