Off canvas dialog using a button
When getting back to this issue I did notice the strange behaviour is gone after upgrading to the latest Drupal 8.6.3. All works as expected even using a button.

I am not able to reproduce the behavior/error from above.