···478478/* fix Fomantic's line-height cutting off "g" on Windows Chrome with Segoe UI */
479479.ui.input > input {
480480 line-height: var(--line-height-default);
481481+ text-align: start; /* Override fomantic's `text-align: left` to make RTL work via HTML `dir="auto"` */
481482}
482483483484.ui.input.focus > input,
+2
web_src/js/index.js
···8484import {initRepoIssueList} from './features/repo-issue-list.js';
8585import {initCommonIssueListQuickGoto} from './features/common-issue-list.js';
8686import {initRepoDiffCommitBranchesAndTags} from './features/repo-diff-commit.js';
8787+import {initDirAuto} from './modules/dirauto.js';
87888889// Init Gitea's Fomantic settings
8990initGiteaFomantic();
9191+initDirAuto();
90929193onDomReady(() => {
9294 initGlobalCommon();
+39
web_src/js/modules/dirauto.js
···11+// for performance considerations, it only uses performant syntax
22+33+function attachDirAuto(el) {
44+ if (el.type !== 'hidden' &&
55+ el.type !== 'checkbox' &&
66+ el.type !== 'radio' &&
77+ el.type !== 'range' &&
88+ el.type !== 'color') {
99+ el.dir = 'auto';
1010+ }
1111+}
1212+1313+export function initDirAuto() {
1414+ const observer = new MutationObserver((mutationList) => {
1515+ const len = mutationList.length;
1616+ for (let i = 0; i < len; i++) {
1717+ const mutation = mutationList[i];
1818+ const len = mutation.addedNodes.length;
1919+ for (let i = 0; i < len; i++) {
2020+ const addedNode = mutation.addedNodes[i];
2121+ if (addedNode.nodeType !== Node.ELEMENT_NODE && addedNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) continue;
2222+ attachDirAuto(addedNode);
2323+ const children = addedNode.querySelectorAll('input, textarea');
2424+ const len = children.length;
2525+ for (let childIdx = 0; childIdx < len; childIdx++) {
2626+ attachDirAuto(children[childIdx]);
2727+ }
2828+ }
2929+ }
3030+ });
3131+3232+ const docNodes = document.querySelectorAll('input, textarea');
3333+ const len = docNodes.length;
3434+ for (let i = 0; i < len; i++) {
3535+ attachDirAuto(docNodes[i]);
3636+ }
3737+3838+ observer.observe(document, {subtree: true, childList: true});
3939+}