Loading ...
Sorry, an error occurred while loading the content.

21528RE: [ydn-javascript] Re: Focus not set on dialog when shown via script

Expand Messages
  • Satyen Desai
    Nov 27, 2007
    • 0 Attachment
      Hi,
      I'm not able to reproduce the problem you mention related to creating
      the Dialog from script, but the problem with the context menu based
      invocation seems to be that the context menu ends up being the last
      thing focused on before it is hidden.

      That is, showDialog is called first, followed by a call to
      MenuItem.focus(), based on the way ContextMenu handles it's clickEvent.

      A possible way around this is provided below, where we wait for the menu
      to be hidden, before showing the Dialog:

      http://yuiblog.com/sandbox/yui/v231/examples/container/contextmenufocus.
      html
      (this example also creates the Dialog from script, to test that issue
      also)

      I don't have too much experience with the Menu widget, but there maybe
      cleaner ways around this issue, based on the way ContextMenu handles
      it's clickEvent.

      Possibly by listening for the clickEvent at the ContextMenu instead of
      the ContextMenuItem, so that it is invoked after the default _onClick
      listener which ContextMenu registers (which sets focus).

      Hope that helps,
      Satyen

      p.s. Another obvious/simple, but fragile way around the issue is to use
      an X ms timeout to call showDialog.
    • Show all 4 messages in this topic