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

Bug/60538 misplaced cursor in comments text editor on ios (#17880)

Kabiru Mwenja9687d2c38e4e
diff --git a/app/components/work_packages/activities_tab/journals/new_component.sass b/app/components/work_packages/activities_tab/journals/new_component.sass
index 11b355b674b..b3ab7ddeaed 100644
--- a/app/components/work_packages/activities_tab/journals/new_component.sass
+++ b/app/components/work_packages/activities_tab/journals/new_component.sass
@@ -15,9 +15,16 @@
width: calc(100% - 40px)
// specific ck editor adjustments
.ck-content
- &.ck-focused
- max-height: 30vh
- &.ck-blurred
- max-height: 10vh
+ @media screen and (max-width: $breakpoint-sm)
+ height: 30vh // set content-height before hand so there's no shift
+ &.ck-focused
+ height: 30vh
+ &.ck-blurred
+ height: 10vh
+ @media screen and (min-width: $breakpoint-md)
+ &.ck-focused
+ max-height: 30vh
+ &.ck-blurred
+ max-height: 10vh
.ck-editor__preview
max-height: 30vh
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
index e5adb92c5f4..ad250cfe799 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
@@ -516,7 +516,12 @@ export default class IndexController extends Controller {
this.onSubmitBound = () => { void this.onSubmit(); };
this.adjustMarginBound = () => { void this.adjustJournalContainerMargin(); };
this.onBlurEditorBound = () => { void this.onBlurEditor(); };
- this.onFocusEditorBound = () => { void this.onFocusEditor(); };
+ this.onFocusEditorBound = () => {
+ void this.onFocusEditor();
+ if (this.isMobile()) {
+ void this.scrollInputContainerIntoView(200);
+ }
+ };
const editorElement = this.getCkEditorElement();
if (editorElement) {
@@ -569,21 +574,14 @@ export default class IndexController extends Controller {
}
}
- private scrollInputContainerIntoView(timeout:number = 0) {
+ private scrollInputContainerIntoView(timeout:number = 0, behavior:ScrollBehavior = 'smooth') {
const inputContainer = this.getInputContainer() as HTMLElement;
setTimeout(() => {
if (inputContainer) {
- if (this.sortingValue === 'desc') {
- inputContainer.scrollIntoView({
- behavior: 'smooth',
- block: 'nearest',
- });
- } else {
- inputContainer.scrollIntoView({
- behavior: 'smooth',
- block: 'start',
- });
- }
+ inputContainer.scrollIntoView({
+ behavior,
+ block: this.sortingValue === 'desc' ? 'nearest' : 'start',
+ });
}
}, timeout);
}
@@ -598,9 +596,7 @@ export default class IndexController extends Controller {
this.addEventListenersToCkEditorInstance();
if (this.isMobile()) {
- // timeout amount tested on mobile devices for best possible user experience
- this.scrollInputContainerIntoView(100); // first bring the input container fully into view (before focusing!)
- this.focusEditor(400); // wait before focusing to avoid interference with the auto scroll
+ this.focusEditor(0);
} else if (this.sortingValue === 'asc' && journalsContainerAtBottom) {
// scroll to (new) bottom if sorting is ascending and journals container was already at bottom before showing the form
this.scrollJournalContainer(true);