Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: this.triggerElement is null #138

Closed
wiryonolau opened this issue Jan 27, 2022 · 3 comments
Closed

Uncaught TypeError: this.triggerElement is null #138

wiryonolau opened this issue Jan 27, 2022 · 3 comments
Assignees

Comments

@wiryonolau
Copy link

Versions
BulmaJS: 0.12.1
Browser: Firefox 96
Operating system: Ubuntu 18.04

Describe the bug
On load console will report

Uncaught TypeError: this.triggerElement is null

To Reproduce
Load with ES5

<link href="/bulma/css/bulma.min.css" media="screen" rel="stylesheet" type="text/css" >
<script type="text/javascript" defer="defer" src="/@vizuaalog/bulmajs/dist/bulma.js"></script>
@wiryonolau
Copy link
Author

I found the problem in the navbar.js

Since its automatically modify the navbar, I need to make sure put a complete navbar element. Any missing component will get the error

This minimum is required

nav.navbar
    div.navbar-brand
         a.navbar-burger
    div.navbar-menu

Example

<nav class="navbar" role="navigation" aria-label="main navigation" data-bulma-attached="attached">
    <div class="navbar-brand">
        <a class="navbar-item" style="margin: 0 10px">
             BRAND
        </a>
        <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
             <span aria-hidden="true"></span>
             <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
        </a>
    </div>
    <div class="navbar-menu">
        <div class="navbar-start">
        </div>
    </div>
</nav>

It fixes for me, but maybe you can give a log if element not exist or skip converting

@VizuaaLOG
Copy link
Owner

Happy to accept a PR to add a more helpful error if the element is missing. I don't use this library or Bulma anymore. Otherwise, I can implement this when I have some time to work on it.

@VizuaaLOG
Copy link
Owner

Fixed in 0.12.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants