Tiptap: Editor styling buttons reload the page

Created on 11 Jun 2020  路  2Comments  路  Source: ueberdosis/tiptap

Describe the bug
Clicking on an editor style button causes the page to reload (the first time)

Steps to Reproduce
Steps to reproduce the behavior:

  1. Add the component to a page and include styling buttons
  2. When loading for the first time clicking on one of the buttons causes the page to reload
  3. After reloading, clicking on the styling button works as expected - ie styles are applied
  4. NOTE: This almost always only happens on the FIRST load but unfortunately it doesnt always happen, making it hard to debug.
  5. If you can't reproduce then see the Testing info below

Fork this or create a new Codesandbox replicating your error
https://codesandbox.io/s/vue-issue-template-h0g28

Expected behavior
Styling buttons should never reload the page but should just apply the styling as expected

Testing

  1. Login to mymemry.com with
    [email protected]
    demo123
  2. Click on New Memry
  3. In the editor highlight some text and click BOLD. Page will reload. Subsequently it will work fine.
    To reproduce again, logout, close the browser tab, reload the site and login again and it will happen again. But only the first time.

Environment

  • Browser chrome
  • Version
    "tiptap": "^1.25.0",
    "tiptap-extensions": "^1.27.0",
bug

Most helpful comment

I've followed the Testing path and took a quick look at the source code.
If I'm not mistaken, when you have a button element inside of a form element, it automatically submits the form after clicking the button.

There are multiple ways of fixing the issue but I think the best approach would be adding the type="button" attribute to each button that is being rendered as the Text Editor button inside the .menubar div container

All 2 comments

I've followed the Testing path and took a quick look at the source code.
If I'm not mistaken, when you have a button element inside of a form element, it automatically submits the form after clicking the button.

There are multiple ways of fixing the issue but I think the best approach would be adding the type="button" attribute to each button that is being rendered as the Text Editor button inside the .menubar div container

@kkolasinski I took your advice and it worked!
Thanks so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

agentq15 picture agentq15  路  3Comments

afwn90cj93201nixr2e1re picture afwn90cj93201nixr2e1re  路  3Comments

klaasgeldof picture klaasgeldof  路  3Comments

ageeye-cn picture ageeye-cn  路  3Comments

unikitty37 picture unikitty37  路  3Comments