mdbootstrap / material-design-for-bootstrap

Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
https://mdbootstrap.com/docs/standard/
MIT License
9.34k stars 1.15k forks source link

Buttons with javascript click event work intermittently in Safari #128

Closed NathanQ closed 6 years ago

NathanQ commented 6 years ago

Any button with a click event doesn't work all the time. examples

// jquery
$('#do-stuff-trigger').on('click', function (event) {
    event.preventDefault();
    doStuff();
});

or

// vanilla
document.getElementById('do-stuff-trigger').addEventListener('click', function( event ) {
    doStuff();
}, false);

When the .btn class is removed from the #do-stuff-trigger where MDB ignores it by not adding it's .waves-effect .waves-light classes, the click function works every time.

smolenski-mikolaj commented 6 years ago

Hi NathanQ,

Please comment following lines in mdb.js file and check if the problem still exists:

Lines 14012 - 14013

// Waves.attach('.btn:not(.btn-flat), .btn-floating', ['waves-light']);
// Waves.attach('.btn-flat', ['waves-effect']);

Regards

NathanQ commented 6 years ago

Thanks @smolenski-mikolaj. My bad. It doesn't seem to be MDB, but rather a WebKit bug https://bugs.webkit.org/show_bug.cgi?id=39620. Sometimes it works, sometimes not. So fucky.

If anyone else experiences it, a fix is doing something like:

<button class="btn etc..">
  <span style="display:block; pointer-events: none">Click Me</span>
</button>