The "button" HTML5 tag renders in the editor previewer, but not rendered posts

I’m not sure if it’s a bug per se. I understand your confusion.

To prevent HTML tags and attributes/classnames from being filtered out, this needs to be explicitly allowed in Discourse core or a plugin.

For example, a default list can be found here:

It’s also possible to allow a tag for the preview only. For example, the image controls have several tag/class name/attribute combinations.

You see the button in preview because it’s a side effect of the tag that is allowed here.
However, the disabled attribute is ignored because it is not defined.

I did not check how the allowed list is parsed; I wonder if it’s the expected behavior. :thinking:. Currently, it seems the tag is allowed regardless of the attributes. I would have expected that the button is not rendered if you are not using exactly, for example, <button class="alt-text-edit-ok btn btn-primary">.

You can make a plugin to allow <button> on post render. Let me know if you need assistance.

1 Like