Coder Social home page Coder Social logo

Comments (4)

valdrinkoshi avatar valdrinkoshi commented on August 28, 2024

Hi @maury91, could you provide a jsbin with the issue? the default value of _boundKeyHandlers is non-null and the behavior never sets it to another value, so maybe your implementor is setting it to null?

from iron-a11y-keys-behavior.

maury91 avatar maury91 commented on August 28, 2024

@valdrinkoshi I've tried to recreate the conditions for the errors, however in this snippet the error doesn't happen.

https://gist.run/?id=6c408a70f06c3ae45102fbe37a55be56

I put in the snippet everything that I think can cause the problem, even using importHref, but without any result.

The version of the components is the same in both the snippet and the real code.

The error happens when the paper-button is moved to another part of the DOM, and the detach event is fired on each behaviour, it's possible that in the snippet the detach event is not fired, or the property is defined.

I put some debug code to show the value of the property for each paper-button and seems undefined, however, is possible that I can't access that property in the way I'm trying.

// I'm accessing the property only for debug, is not part of the real code

The error I get in the real code is:

"TypeError: Cannot read property 'length' of undefined
    at HTMLElement._unlistenKeyEventListeners (http://localhost:8080/bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html:448:38)
    at HTMLElement.detached (http://localhost:8080/bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html:333:14)
    at HTMLElement._invokeBehavior (http://localhost:8080/bower_components/polymer/polymer-micro.html:434:4)
    at HTMLElement._doBehavior (http://localhost:8080/bower_components/polymer/polymer-micro.html:427:6)
    at http://localhost:8080/bower_components/polymer/polymer-micro.html:218:6
    at Object.whenReady (http://localhost:8080/bower_components/polymer/polymer-micro.html:101:1)
    at HTMLElement.detachedCallback (http://localhost:8080/bower_components/polymer/polymer-micro.html:216:22)
    at DomApi.(anonymous function) [as appendChild] (http://localhost:8080/bower_components/polymer/polymer-mini.html:1236:26)
    at http://localhost:8080/app/components/cards/novus-card.html:150:27
    at Array.forEach (native)"

from iron-a11y-keys-behavior.

valdrinkoshi avatar valdrinkoshi commented on August 28, 2024

@maury91 looks like you're manually doing redistribution of content in the ready method of x-card.html. That causes useless attach/detach/attach for each children of your x-cards.
You should use the select attribute of <content> to distribute the content in the correct spots, e.g.

<!-- x-card template -->
<paper-card elevation="0">
   <div id="header">
     <template is="dom-if" if="[[_headerSpinner(headerSpinner,disableLoadingState)]]">
       <paper-spinner id="headerSpinner" active hidden="[[!loading]]"></paper-spinner>
     </template>
     <h1 hidden=[[!heading]]>
       <template is="dom-if" if="[[headerIcon]]">
         <iron-icon class="header-icon" icon="[[headerIcon]]"></iron-icon>
       </template>
       [[heading]]
     </h1>
     <span class="status" hidden=[[!rightText]]>[[rightText]]</span>

     <!-- all headers will go here -->
     <content select="header"></content>

   </div>
   <div>

     <!-- the rest of the content gets distributed here -->
     <content></content>

   </div>
 </paper-card>

More info about <content select= here https://www.polymer-project.org/1.0/docs/devguide/local-dom#dom-distribution

from iron-a11y-keys-behavior.

maury91 avatar maury91 commented on August 28, 2024

@valdrinkoshi Thank you very much, it worked, and the error stop happening, I will pay more attention to the polymer functions before implementing my ones

from iron-a11y-keys-behavior.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.