]> source.dussan.org Git - gitea.git/commitdiff
Forbid deprecated `break-word` in CSS (#30934)
authorsilverwind <me@silverwind.io>
Fri, 10 May 2024 12:25:49 +0000 (14:25 +0200)
committerGitHub <noreply@github.com>
Fri, 10 May 2024 12:25:49 +0000 (12:25 +0000)
Forbid
[deprecated](https://drafts.csswg.org/css-text-3/#word-break-property)
`break-word` and fix all occurences.

Regarding `overflow-wrap: break-word` vs `overflow-wrap: anywhere`:

Example of difference: https://jsfiddle.net/silverwind/1va6972r/

[Here](https://stackoverflow.com/questions/77651244) it says:

> The differences between normal, break-word and anywhere are only clear
if you are using width: min-content on the element containing the text,
and you also set a max-width. A pretty rare scenario.

I don't think this difference will make any practical impact as we are
not hitting this rare scenario.

stylelint.config.js
web_src/css/features/console.css
web_src/css/helpers.css
web_src/css/repo.css
web_src/css/shared/flex-list.css

index 9247eb3c33dd144b04b9762afbd224c18c9cf3f9..6fee2426855b8e43031880630e54207213960b21 100644 (file)
@@ -150,7 +150,7 @@ export default {
     'declaration-property-unit-allowed-list': null,
     'declaration-property-unit-disallowed-list': {'line-height': ['em']},
     'declaration-property-value-allowed-list': null,
-    'declaration-property-value-disallowed-list': null,
+    'declaration-property-value-disallowed-list': {'word-break': ['break-word']},
     'declaration-property-value-no-unknown': true,
     'font-family-name-quotes': 'always-where-recommended',
     'font-family-no-duplicate-names': true,
index 99fb25dae57f35edee8b2d8e5fc46e0fd05e2174..e2d3327cfa5376aff130e666769ccceb21a7df9e 100644 (file)
@@ -5,8 +5,7 @@
   color: var(--color-console-fg);
   font-family: var(--fonts-monospace);
   border-radius: var(--border-radius);
-  word-break: break-word;
-  overflow-wrap: break-word;
+  overflow-wrap: anywhere;
 }
 
 .console img { max-width: 100%; }
index cf2e73572c316bafd4f9f039c9796fa84c86cd18..4d12dfaea2f85d621e0e5c96228204538f637516 100644 (file)
@@ -5,7 +5,6 @@ Gitea's private styles use `g-` prefix.
 
 .gt-word-break {
   word-wrap: break-word !important;
-  word-break: break-word; /* compat: Safari */
   overflow-wrap: anywhere;
 }
 
index f02b2b7578c68268d3d7fe7d8dc0d0dd60d49c10..7f07e732a3bd335587a9cb91492d52148a908996 100644 (file)
@@ -410,7 +410,7 @@ td .commit-summary {
 }
 
 .repository.file.list .non-diff-file-content .plain-text pre {
-  word-break: break-word;
+  overflow-wrap: anywhere;
   white-space: pre-wrap;
 }
 
index 6217b4530093f7a78745d5060fe495c8fb957e72..0f54779252292e1f85d99cbd570cb4caebbef0d0 100644 (file)
@@ -59,7 +59,7 @@
   color: var(--color-text);
   font-size: 16px;
   font-weight: var(--font-weight-semibold);
-  word-break: break-word;
+  overflow-wrap: anywhere;
   min-width: 0;
 }
 
@@ -74,7 +74,7 @@
   flex-wrap: wrap;
   gap: .25rem;
   color: var(--color-text-light-2);
-  word-break: break-word;
+  overflow-wrap: anywhere;
 }
 
 .flex-item .flex-item-body a {