Icon button for Preformatted Text missing in mobile layout

Just a FWIW

I am pretty sure I've posted on my iPad before and could select the Preformatted Text button to encapsulate it, but today, I find it is missing when I try to reply.


Any Other Browser

It’s now the first option under the Gear icon. Not sure when it changed.

1 Like

Bonus! Thank you.

Odd though.

type or paste code here

Thought senility was creeping in.

1 Like

I’m not sure what’s so special about the iPad Safari, but if it can be moved back to the main bar, it would be very useful.

1 Like

I’m thinking it’s that the iPad keypad can’t generate a back tic. AIR I would select the button and then delete the 4 extra back tics to use pre formatted text inline.

Had/Have the same in Chrome, on Android.

It can but it’s inconvenient. Tap the .?123 keyboard, long-press on the quote mark, and select the far right back tick. Now try doing that 3 times in a row.

1 Like

Yes, I use the expanded KB for french accents, but as you said it's inconvenient when you have to hunt and peck to find where the symbol occurs. :roll_eyes:

So, problem solved, and thanks to both.

I've noticed this on my iPhone as well as on a Mac OS and a Chrome OS laptop. But it doesn't seem to be an issue on my Mac desktop (with a 27" display). It seems like the button arrangement may be dynamic based on window/screen size... at least that's my hypothesis.

I have lately (last 2-4 weeks?) noticed this change when writing with my tablet (chrome, Android). Desktop Firefox shows the icon normally.

@tmomas @thess
Any config options/tweak that admins could change to make the button visible in the mobile style/layout?

The "preformatted text" is one the most important buttons there :frowning:

Upstream change:

upstream dev:

I moved the preformatted text button to be hidden within the cog menu on mobile. This is most often used for code, and it seems less likely that someone's sharing code on a mobile device.

discussion and hints:


I'll take a look at this in a bit and see if there is any easy workaround. No promises.


The Preformatted text button is placed in the cog pull-down if discourse thinks you have a 'touch' device - not a mobile device. Personally, I think this is a bad choice since touch is by no means an indicator of screen-size or layout. That said, I am not sure I can override this with CSS hacks. I can add/remove and re-arrange buttons, but I cannot force what is or is not in the cog menu -- at least I haven't found a way yet.


Interesting. Obviously my phone is a touch device, and my Chromebook also has a touch screen. But my older Macbook is not touch at all. Might it be that it infers the touch as a function of the device's screen resolution (even if it doesn't know about layout)?

FWIW, this is the magic in discourse 'sniff-capabilities.js' that sets the property.

const touch = navigator.maxTouchPoints > 1 || "ontouchstart" in window;

Looks to me to be dependent on the browser / platform environment objects.


Would it be possible to swap the preformatted button with the quote button?
I see a number of users wo do not know where to find it.

The buttons that appear in the cog pulldown are embedded in javascript code and AFAICT, you cannot affect these by any CSS hacks. As I mentioned above, I may be able to change order but not the cog-pulldown content.

If you find a way let me know. The best I am hoping for is discourse devs to provide a customization capability. The only solution I can see at the moment is a awfully bad "Monkey Patch", but I'd rather not do that from a support point of view.

1 Like

Thanks to a response to my request for a work-around on the Discourse forum, I have implemented a theme component called formatedCodeButton and have added it to our customized themes. Essentially, it adds the formatCode button to the editor bar if a touch screen is detected and removes it from the cog pull-down. Let's see how it goes...


Seems to work, thnx.

Thanks! :-)

Thanks for taking care of this.
Great that a solution was found.

Documenting here the Discourse upstream discussion and solution: