Shopify themes, liquid, logos, and UX
I have been trying to integrate html2canvas (https://github.com/niklasvh/html2canvas) into my custom Dawn theme (ver 3.0.0). However, whenever html2canvas runs, it tries to generate a screenshot (canvas), it needs to clone the whole page, and that's when error occurs. The errors mainly relates to the built in javascript of the theme when it tries to addEventListener. Some of the rrror as follows:
TypeError: Cannot read properties of null (reading 'addEventListener')
at new DetailsDisclosure (details-disclosure.js?v=11862664082492452288:6:28)
TypeError: Cannot read properties of null (reading 'addEventListener')
at new DetailsModal (details-modal.js?v=451176189667266969:7:27)
TypeError: Cannot read properties of null (reading 'addEventListener')
at HTMLElement.setupEventListeners (predictive-search.js?v=3127871086358158403:14:10)
TypeError: Cannot read properties of null (reading 'querySelector')
at new ProductForm (custom-cablemod-product-form.js?v=6065484525017118644:7:17)
TypeError: Cannot read properties of null (reading 'addEventListener')
at new DetailsDisclosure (details-disclosure.js?v=11862664082492452288:6:28)
at new ShareButton (share.js?v=2305955673173102667:4:7)
TypeError: Cannot read properties of null (reading 'addEventListener')
at new ModalDialog (global.js?v=13896767922069093276:431:46)
at new ProductModal (scripts.js?49097:326:7)
There are some more from other theme scripts but basically I see the theme scripts with classes extend to HTMLElement..., isn't this a very bad practice, trying to extend to the standard DOM? I find it very difficult to debug and try to work around the errors. Anyway appreciate if someone can provide a solution to this...
e.g. class DetailsDisclosure extends HTMLElement {...}
User | RANK |
---|---|
221 | |
145 | |
63 | |
46 | |
45 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023