A discussion about improving the “Characters Required” plugin for Discourse. alltiagocom suggests adding character counting to the title and changing the text from “N characters required” to “N characters left” for better user feedback. merefield responds that a Theme Component already exists to achieve this, making the plugin unnecessary, as Theme Components didn’t exist when the plugin was created. Canapin questions why the official solution is a plugin instead of a Theme Component, and merefield clarifies that Theme Components weren’t available at the time. alltiagocom shares a modified version of the Theme Component with changes to text color and display (e.g., “0 of N required”), noting it feels less intrusive. merefield encourages forking and modifying the component, emphasizing compactness and language independence. alltiagocom expresses unfamiliarity with GitHub but appreciates the tool. A bug is reported where spaces at the end of text aren’t counted in the character display, though merefield explains this is intentional as Discourse trims trailing spaces. alltiagocom acknowledges the behavior is confusing but accepts it, praising the tool’s usefulness.
1 - Adding the same feature to the title would be valuable as well. Showing that there’s also a minimum number of characters there is a must.
2 - Once the user starts typing, the text could change from N characters required to N characters left (or remaining). Then if the person deletes the text again, it goes back to required. This one is just a small tweak to make the feature more consistent to what’s happening at a given moment. Not a “must”, just a tweak.
My Theme Component makes the plugin completely unnecessary. The plugin is quite old and predates the Theme Components. It wasn’t an option when it was built.
Where were you a few hours go to prevent me from having to go through the painful process of installing the plugin?
That is indeed what I wanted.
A few suggestions, if you think they are worth implementing:
1 - Ability to change the color of the text. In my particular case, I like it in the original color. On my non-professional UI expertise, I like to see red only when something is over the limit, for example, too many characters that will throw an error if I try to save, or if it doesn’t follow a specific format (e.g. a URL, an email, etc). The red for me here automatically looks “weird”, because it’s almost as if something is already wrong, even before I did anything.
2 - Showing something like “0/15” kinda feels like: “you haven’t typed anything on your limit of just 15 characters”. I know that people eventually understand what that means, but I always like to have everything as clear as possible, even for people who know what that means. So in this case, offering a few different options would be great, one of them being 0 of N required.
I downloaded the ZIP from GitHub and made those modifications for myself and now it looks like this:
I’m not very familiar with GitHub and all that. I just make small changes to things I know and in this case ChatGPT helped, but GitHub is a completely foreign world…
I think this isn’t an issue, especially because I will have it to remove the text once it meets the requirement.
One “bug” I noticed though is that when using SPACE it doesn’t show in the count, even though it counts it.
So A counts as 2, but the text only shows 1 of 15 instead of 2 of 15
Ah it trims the ends of the text of spaces. Which is what Discourse does (spaces at either end don’t count and won’t be saved). You will notice it catches up once you type another character which is not a space. So I believe the current implementation is correct.
Yes, I noticed that when I typed another character it would catch up. Still weird that this is the behavior, because if a space is counted as a character, then it should be visible, otherwise if it shows 13 and the limit is 15, that means I have 2 more characters, but then it jumps from 13 to 15 (in my case it will hide the count). All because there’s a space at the end. It can be a bit confusing for the users.
But if it’s something you can’t change, then I guess “it is what it is”
This is already a useful tool, regardless. Thanks