diff --git a/packages/survey-creator-core/src/creator-base.ts b/packages/survey-creator-core/src/creator-base.ts index 4e19562d1b..8efde87c7d 100644 --- a/packages/survey-creator-core/src/creator-base.ts +++ b/packages/survey-creator-core/src/creator-base.ts @@ -18,7 +18,7 @@ import { IsTouch } from "survey-core"; import { QuestionConverter } from "./questionconverter"; import { SurveyTextWorker } from "./textWorker"; import { QuestionToolbox, QuestionToolboxItem } from "./toolbox"; -import { assign } from "./utils/utils"; +import { assign, getOS } from "./utils/utils"; import { getNextItemValue, getNextItemText } from "./utils/creator-utils"; import { PropertyGridModel } from "./property-grid"; import { ObjType, SurveyHelper } from "./survey-helper"; @@ -356,7 +356,10 @@ export class SurveyCreatorModel extends Base this.startEditTitleOnQuestionAddedValue = value; } public get startEditTitleOnQuestionAdded() { - return !this.isMobileView && !this.toolbox.searchManager.filterString && this.startEditTitleOnQuestionAddedValue; + return !this.isMobileView && + !((this.currentOS == "iOS" || this.currentOS == "Mac OS") && this.isTouch) && + !this.toolbox.searchManager.filterString && + this.startEditTitleOnQuestionAddedValue; } private startEditTitleOnQuestionAddedValue: boolean = true; private isRTLValue: boolean = false; @@ -1522,6 +1525,7 @@ export class SurveyCreatorModel extends Base this.initTabs(); this.syncSaveButtons = this.options.saveSurveyAndTheme !== undefined ? this.options.saveSurveyAndTheme : this.options.syncSaveButtons; this.isTouch = IsTouch; + this.currentOS = getOS(); const expandAction = this.sidebar.getExpandAction(); !!expandAction && this.toolbar.actions.push(expandAction); } @@ -4172,6 +4176,7 @@ export class SurveyCreatorModel extends Base } }) isMobileView: boolean; @property({ defaultValue: false }) isTouch; + currentOS: string; /** * Specifies the Toolbox location. * diff --git a/packages/survey-creator-core/src/utils/utils.ts b/packages/survey-creator-core/src/utils/utils.ts index 5fca4cb7c3..faa0829a58 100644 --- a/packages/survey-creator-core/src/utils/utils.ts +++ b/packages/survey-creator-core/src/utils/utils.ts @@ -86,4 +86,27 @@ export function sortDefaultThemes(defaultThemesOrder: Array, themes: Arr resultArray.push(themeName); } }); +} + +export function getOS(): "Mac OS" | "iOS" | "Windows" | "Android" | "Linux" { + const userAgent = window.navigator.userAgent, + platform = (window.navigator as any)?.userAgentData?.platform || window.navigator.platform, + macosPlatforms = ["macOS", "Macintosh", "MacIntel", "MacPPC", "Mac68K"], + windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"], + iosPlatforms = ["iPhone", "iPad", "iPod"]; + let os = null; + + if (macosPlatforms.indexOf(platform) !== -1) { + os = "Mac OS"; + } else if (iosPlatforms.indexOf(platform) !== -1) { + os = "iOS"; + } else if (windowsPlatforms.indexOf(platform) !== -1) { + os = "Windows"; + } else if (/Android/.test(userAgent)) { + os = "Android"; + } else if (/Linux/.test(platform)) { + os = "Linux"; + } + + return os; } \ No newline at end of file