diff --git a/src/calendar-app/calendar/gui/eventeditor-view/RepeatRuleEditor.ts b/src/calendar-app/calendar/gui/eventeditor-view/RepeatRuleEditor.ts index 93cb72083939..0d695a47ef2f 100644 --- a/src/calendar-app/calendar/gui/eventeditor-view/RepeatRuleEditor.ts +++ b/src/calendar-app/calendar/gui/eventeditor-view/RepeatRuleEditor.ts @@ -9,11 +9,12 @@ import { createCustomEndTypeOptions, createIntervalValues, createRepeatRuleOptio import { px, size } from "../../../../common/gui/size.js" import { Card } from "../../../../common/gui/base/Card.js" import { RadioGroup, RadioGroupAttrs, RadioGroupOption } from "../../../../common/gui/base/RadioGroup.js" -import { SingleLineTextField } from "../../../../common/gui/base/SingleLineTextField.js" +import { InputMode, SingleLineTextField } from "../../../../common/gui/base/SingleLineTextField.js" import { Select, SelectAttributes } from "../../../../common/gui/base/Select.js" import stream from "mithril/stream" import { Divider } from "../../../../common/gui/Divider.js" import { theme } from "../../../../common/gui/theme.js" +import { isApp } from "../../../../common/api/common/Env.js" export type RepeatRuleEditorAttrs = { model: CalendarEventWhenModel @@ -220,12 +221,14 @@ export class RepeatRuleEditor implements Component { options: this.intervalOptions, noIcon: true, expanded: true, - tabIndex: Number(TabIndex.Programmatic), + tabIndex: isApp() ? Number(TabIndex.Default) : Number(TabIndex.Programmatic), classes: ["no-appearance"], renderDisplay: () => m(SingleLineTextField, { classes: ["border-radius-bottom-0"], value: isNaN(this.repeatInterval) ? "" : this.repeatInterval.toString(), + inputMode: isApp() ? InputMode.NONE : InputMode.TEXT, + readonly: isApp(), oninput: (val: string) => { if (val !== "" && this.repeatInterval === Number(val)) { return @@ -300,12 +303,14 @@ export class RepeatRuleEditor implements Component { options: this.occurrencesOptions, noIcon: true, expanded: true, - tabIndex: Number(TabIndex.Programmatic), + tabIndex: isApp() ? Number(TabIndex.Default) : Number(TabIndex.Programmatic), classes: ["no-appearance"], renderDisplay: () => m(SingleLineTextField, { classes: ["tutaui-button-outline", "text-center", "border-content-message-bg"], value: isNaN(this.repeatOccurrences) ? "" : this.repeatOccurrences.toString(), + inputMode: isApp() ? InputMode.NONE : InputMode.TEXT, + readonly: isApp(), oninput: (val: string) => { if (val !== "" && this.repeatOccurrences === Number(val)) { return diff --git a/src/common/gui/base/SingleLineTextField.ts b/src/common/gui/base/SingleLineTextField.ts index cd1ce408df7e..db0d75c95e37 100644 --- a/src/common/gui/base/SingleLineTextField.ts +++ b/src/common/gui/base/SingleLineTextField.ts @@ -3,6 +3,12 @@ import { TextFieldType } from "./TextField.js" import { AllIcons, Icon, IconSize } from "./Icon.js" import { px, size } from "../size.js" +export enum InputMode { + NONE = "none", + NUMERIC = "numeric", + TEXT = "text", +} + export interface SingleLineTextFieldAttrs extends Pick { value: string | number ariaLabel: string @@ -30,6 +36,8 @@ export interface SingleLineTextFieldAttrs extends Pick< icon: AllIcons color: string } + inputMode?: InputMode + readonly?: boolean } export interface SingleLineNumberFieldAttrs extends SingleLineTextFieldAttrs { @@ -126,6 +134,9 @@ export class SingleLineTextField implements ClassCompon ...(inputPadding ? { paddingLeft: inputPadding } : {}), ...attrs.style, }, + type: attrs.inputMode === InputMode.NONE ? undefined : attrs.type, + inputMode: attrs.inputMode, + readonly: attrs.readonly, ...this.getInputProperties(attrs), }) }