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

**URL:** https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026
**Category:** UX
**Created:** [October 3, 2016, 4:53pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026 "2016-10-03T16:53:57Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [October 3, 2016, 4:53pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/1 "2016-10-03T16:53:58Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [October 3, 2016, 5:31pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/2 "2016-10-03T17:31:07Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 3, 2016, 5:54pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/3 "2016-10-03T17:54:50Z")

</div>

> [@elijah](#):
>
> I didn’t know there were any keystrokes of that sort.

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

There’s also a [composer help button](https://meta.discourse.org/t/composer-help-button/22748) plugin that’ll give you a list of them.

> [@elijah](#):
>
> Could it be a Mac specific issue?

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.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [October 3, 2016, 5:57pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/4 "2016-10-03T17:57:43Z")

</div>

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

![](https://global.discourse-cdn.com/meta/optimized/3X/e/4/e4066178730fff82dcaade2c12ca11a0902e28c5_2_690x48.gif)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [October 3, 2016, 6:00pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/5 "2016-10-03T18:00:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [October 3, 2016, 6:47pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/6 "2016-10-03T18:47:00Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [October 4, 2016, 4:57pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/7 "2016-10-04T16:57:05Z")

</div>

Tomayto, Tomahto 😉

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 4, 2016, 9:21pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/8 "2016-10-04T21:21:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 5, 2016, 6:26am UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/9 "2016-10-05T06:26:16Z")

</div>

for context:

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

> [@Pressing shift+enter in quoted text isn't undoable](https://meta.discourse.org/t/pressing-shift-enter-in-quoted-text-isnt-undoable/26897):
>
> Here’s a block of quoted text for your convenience if you want to repro by editing this post: Lorem ipsum dolor sit amet, PRESS SHIFT ENTER HERE consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat no…

> [@Ctrl+Z does not undo my previous step](https://meta.discourse.org/t/ctrl-z-does-not-undo-my-previous-step/23507):
>
> When I type something in the textarea , and select all, and ctrl+b ,and ctrl+z. I just want to undo my ctrl+b step, however it completely my textarea. I have to type the content again. It is weird the ctrl+z means clearing textarea instead of undo.

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.

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [October 5, 2016, 7:07am UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/10 "2016-10-05T07:07:39Z")

</div>

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 😅

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.)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 5, 2016, 7:11am UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/11 "2016-10-05T07:11:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 5, 2016, 1:43pm UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/12 "2016-10-05T13:43:46Z")

</div>

> [@alehandrof](#):
>
> 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.

I had my students do this:

[https://literatecomputing.com/t/learn-markdown-text-only-markup/533](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.

---

<div class="post-metadata">

### Author: ![Sujan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sujan/32/70979_2.png) [@Sujan](https://meta.discourse.org/u/Sujan)
#### Post date: [July 17, 2017, 7:43am UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/13 "2017-07-17T07:43:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 17, 2017, 9:55am UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/14 "2017-07-17T09:55:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 17, 2017, 9:55am UTC](https://meta.discourse.org/t/undo-ctrl-cmd-z-doesnt-work-for-markdown/51026/15 "2017-07-17T09:55:16Z")

</div>


