Results 1 to 3 of 3

Thread: component.hasListeners contains invalid information

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1

    Default component.hasListeners contains invalid information

    Specifing controller's listen config on component domain for any selector and any event increases hasListeners property for the specified event for ALL components instead of only specified. This makes hasListeners property useless.

    Also this produces an ARIA console error on menu button, see example.

    Example: https://fiddle.sencha.com/#fiddle/r00

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,253

    Default

    Not really sure why you're saying this is a bug. The listener for the controller gets wired in at a very early stage and needs to dynamically handle components as they come online/offline. As such, we only determine whether or not something matches the selector when an event is fired, there's too much overhead in trying to manage the component lifecycle to attach/detach listeners in such a way. So, technically speaking, all buttons do have a click listener, but we don't know whether or not it matches until fire time.

    If you want to check if a specific instance has a listener, you could use:

    Code:
    btn.hasListeners.hasOwnProperty('click')
    As far as the ARIA error goes, if you're looking to create an ARIA compliant app, you shouldn't use the menu button. If not, then you can ignore it.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3

    Default

    I reported this as a bug because of ARIA warning about the event handler which I haven't directly attached to the component. Now I undestand how it works, thanks. So, if using a menu button makes an application non ARIA compliant why don't ExtJs warns me about a handler but not about a whole menubutton?

    And one interesting question to think about: as I see, using component domain in controller listen config is a very typical scenario, so what the real use of hasListeners then? You can't relly on hasListeners.click because it always true in typical scenario and you can't relly on hasListeners.hasOwnProperty('click') because you can miss that listener in controller which supplied with exactly matching selector for the component? May be hasListeners should be deprecated?

Similar Threads

  1. Replies: 3
    Last Post: 25 Mar 2015, 2:12 PM
  2. Replies: 2
    Last Post: 11 Dec 2014, 9:55 AM
  3. Replies: 0
    Last Post: 10 Dec 2014, 9:23 AM
  4. The error information 'invalid XML attribute value'
    By wguo in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 1 Jul 2009, 1:30 AM
  5. Replies: 4
    Last Post: 19 Dec 2007, 8:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •