Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

handle chrome retaining style

Bruno Pagno6f2a34239d1a
diff --git a/frontend/src/stimulus/controllers/pattern-input.controller.ts b/frontend/src/stimulus/controllers/pattern-input.controller.ts
index afbe812842b..403f076fcf0 100644
--- a/frontend/src/stimulus/controllers/pattern-input.controller.ts
+++ b/frontend/src/stimulus/controllers/pattern-input.controller.ts
@@ -120,7 +120,16 @@ export default class PatternInputController extends Controller {
this.tagInvalidTokens();
- // update cursor
+ // this resets the cursor position without changing it
+ // it is necessary because chromium based browsers try to
+ // retain styling and adds a unwanted <font> tag,
+ // breaking the behaviour of this component
+ const selection = document.getSelection();
+ if (selection && selection.rangeCount) {
+ const range = selection.getRangeAt(0);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ }
this.setRange();
}