Undo (Ctrl/Cmd+Z) doesn't work for Markdown

You can’t undo (Ctrl/Cmd+Z) Markdown formatting (e.g., bold).

Steps to replicate:

  1. Start a new topic.
  2. Write three words.
  3. Highlight the second word and press Ctrl/Cmd+B
  4. Press Ctrl/Cmd+Z

Expected result: Asterisks would be removed

Actual result: Different in different browsers tested (Safari & Chrome on macOS), but not the expected result.

1 Like

I never knew ctrl-B would trigger bold. I didn’t know there were any keystrokes of that sort.

Anyway, I tried it, Firefox on Linux, and could not reproduce it.

I mean ctrl-B did embolden and ctrl-Z did undo for me. Could it be a Mac specific issue?

They are hinted at if you mouseover the various icons in the composer, but you probably never did that either. :slight_smile:

There’s also a composer help button plugin that’ll give you a list of them.

Could be. On this Mac, command-z undoes the typing that I did, but not the bold. I think that undo is also similarly broken under Linux, but I’ve never thought to call it a bug.

1 Like

Here’s what happens for me in Chrome on Windows:

1 Like

I tried just now with Vivaldi on Windows.

ctrl-b bolded fine. … but it then went to the “open bookmarks”

ctrl-z only moved the cursor position to after the bolded text, but I think the opening of bookmarks resulted in losing focus and may have been the cause.

EDIT
or maybe not.

I may not have found the correct place to look, but based on my initial searching, I don’t think this is a Discourse bug.

Discourse does not seem to apply any bindings to CTRL+Z, so it is letting the browser handle it and it seems each browser sucks at it in various degrees (some are REALLY bad and others mildly horrendous).

(just noticed @Falco moved this to UX, which seems to support my findings)

7 Likes

Tomayto, Tomahto :wink:

I had a user complain to me that the undo function is broken and I passed on his findings here in a reproducible way.

Gmail, Basecamp and other WYSIWYG tools allow users to undo formatting changes. In Discourse’s case the formatting is simply the Markdown markup. Since shortcuts/buttons for the markup are available, those functions should be undo-able. StackEdit, for example, handles this gracefully. Not doing so subverts a reasonable user expectation.

1 Like

It’s the built-in browser controls only, you could dump a <form> element on a HTML page and play with that to see how it works.

You can also read a whole lot of previous discussion on this which defines how we arrived where we are. We used to have these buttons and removed them because they were confusing to users. You may like going in circles, but I don’t.

2 Likes

for context:

https://meta.discourse.org/t/ctrl-z-undo-and-redo-will-ignore-pasting/4537

This is a can of worms, if someone wants to build a plugin to explore undo/redo again all the integration hooks are in place.

4 Likes

Thanks for adding this context, Sam. I had found some but not all of these topics and thus only had an imperfect understanding of the misadventures of undoing in Discourse.

I don’t like being accused of going round in circles or opening cans of worms, but I guess in this case it’s true :sweat_smile:

I’ll stand by my earlier point: from a joe user’s perspective not being able to undo syntax changes looks like broken/missing functionality.

I’m having trouble as it is getting my users to buy into using Markdown. Having a Markdown editor that is so limited increases the difficulty. In general, the editor is quite weird. Would it help to begin cataloging the issues/limitations, or is there an existing list somewhere?

(I’m sorry I don’t have anything more useful to offer than some gentle bug reporting.)

1 Like

afaik there is no canonical list of problems, but to be honest, kitchen sink type issues usually get low levels of traction, we much prefer a topic per issue usually.

3 Likes

I had my students do this:

https://literatecomputing.com/t/learn-markdown-text-only-markup/533

Of course, being able to use grades to coerce people to do stuff probably isn’t something you can do. Nevertheless, people claimed to like learning markdown. For the most part, once you understand that two stars make something bold, there’s little reason to get the editor to do it. For some people, anyway.

1 Like

I think there are two related, but seperate problems here:

  1. Undo doesn’t work for the actions of toolbar buttons and shortcuts
  2. Using the toolbar buttons breaks the edit history of the input so using Ctrl + Z actually does really unexpected thing.

Is 1) really a problem no editor in the web has solved yet?
Same for 2) which is really confusing to users.

1 Like

There are zero plans to revisit this. Closing this topic because bikeshedding. The native browser form input element behavior is what you get – if you don’t like that, take it up with your friendly neighborhood browser vendor.