Feature #1918
closedCapitalization of first letter with CSS
Description
In OpenAtlas there are many cases were we want the capitalization of the first letter, e.g for buttons, tab headers, ...
There is a CSS way of doing it e.g.
<html>
<head>
<style>div::first-letter {text-transform: uppercase;}</style>
</head>
<body>
<div>mm</div>
</body>
</html>
But because it wasn't working correctly with Firefox a few years ago, we are using the Python function uc_first() located in openatlas/util/util.py
@app.template_filter()
def uc_first(string: str) -> str:
return str(string)[0].upper() + str(string)[1:] if string else ''
There are 250+ calls to this function in the OpenAtlas code base and it would be great, if we could replace these with an CSS implementation. It would greatly reduce the Python code and so make parts of it much more readable.
Much things have changed in the last years so I would like to ask Andi (or Mocca) to look into this and evaluate, if the CSS implementation first-letter {text-transform: uppercase;} would be viable now.
I'm tracking one related Mozilla bug (still open after 13 years): https://bugzilla.mozilla.org/show_bug.cgi?id=385615 but I'm not sure, if this is relevant for this case.
Files