You wouldn’t believe how often I do shit like this. Our brains love to completely miss the simple solution and over complicate shit because so many things we work on can be complicated.
As a programmer of 20 years I just finished making a whole complex algorithm to replace an element in a list. Only after some time did I remember I could just do List[index] = thing...
Or you have co-workers who will argue indefinitely how you should separate styling appearance from code, because in a year you migh want to have it in lowercase and you can't retype because it's idealogically wrong and you need to have this style in all pages and apps (just to use different framework in 6 months and rewrite everything).
In case anyone cares, \textsc{...} would be how you do that transform where uppercase letters stay capitalized, and lowercase letters are rendered as small capitalized letters. Small caps is the name of this, in general.
Also if you have a small ton of buttons on the website and the OG design is all caps.... Still do it 2nd way;
Because if you have a B design coming in later in the dev process or hell in a few years... If that capitalisation is removed then ooops you have now to run through all buttons and retype them in not caps.
There are legitimate uses for !important even if not overriding legacy styling. I've had to use !important a few times before to force CSS to apply rules the exact way I needed them.
I'm pretty terrible at web design but I try to limit my use of !important overrides to occasions where I've inherited some stylesheet from somewhere else, like the component toolkit my stack is using.
If you're not saying "...and fuck you!" under your breath about the last person to own the CSS while you type it, it's a sign you might be using !important where you don't need to.
If this must be editable, then in the CMS you now have:
Button label
Button Aria label
Or you could just have "Button label" and in the code apply text-transform: uppercase. Granted, the button label is an arbitrary use case and most would just simply hard-code it, however, that may not be the case if you're also now thinking about internationalization, in which case you may want that in a CMS or in language files and don't have the time/desire to start plugging in lower/upper variants (nor would that make sense when the computer can do these transforms for you automatically).
All caps is a style and typography choice, not a content choice. Content belongs in the DOM. Styles belong in CSS.
Follow those rules, and use proper HTML elements, and like 90% of accessibility devices will be able to properly convey your document to a variety of users who are consuming it in various ways.
For control type labels capitalization is not a criteria. And I know I'm being all "acktually🤓", I just don't like that companies are forced to spend disproportionate amounts of effort to adhere to small percentage of a customer base and their problems.
And no, I am NOT saying people that have issues with running text in all caps are that small of a percentage. I'm just talking in a more general sense. Cost-benefit efficiency and all that.
I just don't like that companies are forced to spend disproportionate amounts of effort to adhere to small percentage of a customer base and their problems.
The Americans with Disabilities Act doesn't care what you think, and people with opinions like yours are why the law needs to exist.
Cost-benefit efficiency and all that.
During the design refresh, all-caps has gone out of style. Would you rather update the one line of the style rule and fix the all-caps buttons all over the site, or update the structure of the site all places where your all-caps controls were hard-coded?
It is literally more efficient to separate style and structure.
Moreover, accessibility guidelines have been in place for what, 20 years now? So legacy code is not even a valid excuse anymore.
Companies who are unable to follow the most basic best practices from the get go, thinking it's a "disproportionate amount of effort" can kindly fuck off towards failure.
No company fails because of that, and most companies dgaf. You people have to finally accept it, the entire world won't double their efforts to cater to 0.00001% blind
Depending on the screen reader, some will read correct as "submit" whilst others will read as S U B M I T, so they will spell the letters instead of reading the word.
Or content management or language/translation lists, particularly if the style dictates a particular appearance but the content is reused in multiple locations.
a11y though I think is probably one of the better examples.
Another idea -- split the innerHtml string into an array, loop and capitalize each letter one at a time with toUpperCase(), join the array back together, set the resulting string to the innerHtml
I mean, wouldn’t it be better to define a class with the text-transform style rather than assigning it as a global property? Mostly since you’d have to fight against you own defined style if you wanted a button in lowercase.
Then you remember 'leading-X' exists and controls the 'line-height' property. Like, yes, I know that's what it was called in typography in printing presses and all that but...this isn't print. Hell, MS Word calls it line spacing which is a lot closer to 'line-height' than 'leading'
That's a weird restraint, isn't it? You could just as well require the opposite: “change to lowercase without modifying the content” (which is more common because different people may handle UI design and text, or it's needed due to localisation, so you don't have to needlessly translate both uppercase and lowercase variants).
Both are client side. Rendering is always client side. First one is clean, no overhead. 2nd one applies text transformation style. The overhead is negligible. There is 0 difference in performance. 1st one is written by a junior. 2nd one is written by a senior who doesn’t want to rewrite uppercase strings to lowercase in case of redesign.
Writing an unlocalized "Submit" string in your html is basically like writing pi every time you need it in your algorithms... I mean... Pi isn't going to change after all... So it's even worse, now I think about it.
So many of you have never had to deal with translations. Oh yes, it's soooo much simpler and easier to hardcode values when your site is translated in 20 languages and has 20 pages with 400 UI elements each.
Oh you're trying to show dynamic values from a database? Well fuck you then
Now take the text out and put it a constant that’s injected into the button tag, and then THAT constant is extracted out for i18n reasons and the “Submit” actually lives in a json file
Hot take: all-caps buttons are a giant pet peeve, and I have always thought that the argument that it somehow helps accessibility is completely arbitrary when it only applies to the button and things like aria tags exist.
Hey at least it's not the LLMs when you forget to say no comments:
def to_uppercase(input_string: str) -> str:
"""
Converts a given string to its uppercase equivalent.
This function accepts exactly one argument and performs exactly
one operation on it, a fact which this docstring insists on
explaining at length regardless.
Args:
input_string (str): The string to be converted to uppercase.
It is a string. Its name is `input_string`. That is all.
Returns:
str: The uppercase version of `input_string`, returned as a
string, because that is what strings become when you
uppercase them.
Example:
>>> to_uppercase("hello")
'HELLO'
"""
return input_string.upper()
You wouldn't believe it but I test Ais as well as a pentester and trying to get them to waste resources like that is a legit goal of mine & a vulnerability to report when successful
2.1k
u/dajoli Sep 25 '26 •
I genuinely spent about 10 minutes googling how to transform to uppercase in LaTeX once before I remembered that I could just type in caps.
541
u/Calien_666 Sep 25 '26
When thinking about accessibility, this totally makes sense.
154
u/HomsarWasRight Sep 25 '26
Yeah, and doing it in CSS is correct, because displaying in all uppercase is a style choice, not a content choice.
66
u/NatoBoram Sep 25 '26
✋
"true"👍
true.toString()20
u/lxlmandudelxl Sep 25 '26
let button = document.getElementsByTagName("button'')[0]; button.innerText = button.innerText.toUpperCase();
9
u/kahless2k Sep 25 '26
Second one is correct as all uppercase text on button violates wcag.
And all uppercase text is terrible UI anyways, even with the css transform.
8
u/Haunted-Chipmunk Sep 25 '26
Don't forget to stick that hardcored string into a i18n language file
13
u/samu1400 Sep 25 '26
I mean, wouldn’t it be better to define a class with the text-transform style rather than assigning it as a global property? Mostly since you’d have to fight against you own defined style if you wanted a button in lowercase.
4
u/Mynameismikek Sep 25 '26
Yeah, so some of us have designers who keep working after the first draft.
10
u/Agloe_Dreams Sep 25 '26
Or to modern devs/Vibecoders....
3
u/BigGuyForYou_ Sep 25 '26
I wish we could chain multiple !important to gain precedence. I want to live in that world because it would be funny
7
u/BornAgainBlue Sep 25 '26
Cool. Now change it to lowercase without modifying any source code.
5
u/iSpaYco Sep 25 '26
more like
<button>Submit</button>
<button>cancel</button>
<button>apply</button>
<button>reset</button>
<style> button { text-transform: uppercase; } </style>
4
u/ara1597 Sep 25 '26
Does one require more processing power to do? And is it client side ?
2
u/L4ppuz Sep 25 '26
So many of you have never had to deal with translations. Oh yes, it's soooo much simpler and easier to hardcode values when your site is translated in 20 languages and has 20 pages with 400 UI elements each.
Oh you're trying to show dynamic values from a database? Well fuck you then
2
u/Fistinguranus69 Sep 25 '26
As a localization engineer the bottom one is the correct choice for maximum translation memory matching
2
u/maggitronica Sep 26 '26
Now take the text out and put it a constant that’s injected into the button tag, and then THAT constant is extracted out for i18n reasons and the “Submit” actually lives in a json file
2
u/SignoreBanana Sep 26 '26
Your localization team just caught on fire.
2
u/wackOverflow Sep 26 '26
Congrats, now all the buttons are uppercase.
KISS
1
u/6HCK0 Sep 25 '26
We'll never know the final user.
1
u/EGObattle Sep 25 '26
But this gets actually relevant once you let the costumer add multiple languages. I have seen stuff 😵💫
1
u/pancakesausagestick Sep 25 '26
It's SeMANtIC! I wouldn't SCREAM the word "submit". It's just a suggestion! But our UI standards render everything in UPPERCASELETTERS!!! AAHH!!!!
1
u/schewb Sep 25 '26
Hot take: all-caps buttons are a giant pet peeve, and I have always thought that the argument that it somehow helps accessibility is completely arbitrary when it only applies to the button and things like aria tags exist.
1
u/bloody-albatross Sep 25 '26
I prefer
font-variant: small-caps;, if at all.1
u/AgentCendol Sep 25 '26
This is good so if you decide to go not all caps, easy switch .
1
u/FakeManiz Sep 25 '26
If you have only one button this is the way to go, no caps on text! I would use id for the button to spare other buttons from capitalization.
1
u/datmrdolphin Sep 26 '26
Love the text-transform property
1
u/Aengeil Sep 26 '26
some does that lol?
i only use when transforming DB data for display
1
u/lift_spin_d Sep 26 '26
https://imgur.com/a/EZoZGxP
1
u/1337boi1101 Sep 26 '26
It is known
1
u/Ezekeal Sep 26 '26
{{i10n.Submit}}
1
u/Appropriate-Wind-184 Sep 25 '26
fun bonus with the second one: put lang="tr" on the page and css turns it into SUBMİT with a dotted capital i. free localisation nobody asked for
1
u/Important_Grab3544 Sep 26 '26
What a waste of internet bandwidth
0
u/febox6 Sep 25 '26
I just did this today lmao
274
u/[deleted] Sep 25 '26
[removed] — view removed comment