leafwiki icon indicating copy to clipboard operation
leafwiki copied to clipboard

Create Section behaves differently when submitted with Enter vs. clicking Create

Open lukxxx opened this issue 2 months ago • 6 comments

Bug Report

What happened?

Submitting the Create Section form with the Enter key behaves differently from clicking the Create button.

When I click Create, the section is created in the sidebar and I stay on the page I am currently viewing.

When I press Enter while the section name field is focused, the section is created, but LeafWiki navigates to the newly created section/editor.

Both submission methods should behave consistently.

Version

v0.13.0

Platform

  • [x] Desktop Web
  • [ ] Mobile Web

Running on

  • [x] Docker
  • [ ] linux amd64
  • [ ] windows amd64
  • [ ] linux arm64
  • [ ] MacOS

Steps to reproduce

  1. Open the sidebar and click Create Section.
  2. Enter a name for the new section.
  3. Press Enter to submit the form.
  4. Notice that the section is created and LeafWiki navigates to the new section/editor.
  5. Repeat the same process, but click the Create button instead of pressing Enter.
  6. Notice that the section is created, but the currently viewed page remains open.

Expected behavior

Submitting the form with Enter should behave the same as clicking the Create button.

I prefer the current behavior of the Create button: the section should be created in the sidebar without navigating away from the currently viewed page. However, that is only my preference; the important part is that both submission methods behave consistently.

Screenshots / recording

I don’t have a recording available right now, but I can add one later if needed.

lukxxx avatar Sep 15 '26 16:09 lukxxx

Hi @lukxxx,

You are right.

perber avatar Sep 16 '26 15:09 perber

Hi @perber, thanks for confirming. I noticed you assigned this to yourself. Are you planning to work on the fix, or would you be okay with me picking it up? I’d be happy to contribute it as a first issue if you are not in a rush with it

lukxxx avatar Sep 17 '26 21:09 lukxxx

Sure. You can do it.

perber avatar Sep 17 '26 21:09 perber

Thanks for assigning it to me. I’m planning to work on it this week and will open a PR once it’s ready

lukxxx avatar Sep 20 '26 20:09 lukxxx

Hi @lukxxx,

Do you have time to work on it?

perber avatar Oct 22 '26 15:10 perber

Hi @lukxxx, we took care of this one as a quick fix in #1816, since it turned out to be a small change. Thanks again for the report and for offering to pick it up! If you'd still like to contribute, feel free to grab another good first issue.

perber avatar Nov 13 '26 21:11 perber