diff --git a/blocks/form/form.js b/blocks/form/form.js index ed5f8fb310..c2c3df3e15 100644 --- a/blocks/form/form.js +++ b/blocks/form/form.js @@ -99,11 +99,11 @@ const createSelect = withFieldWrapper((fd) => { const optionNames = fd?.enumNames ?? options; if (options.length === 1 - && options?.[0]?.startsWith('https://')) { + && options?.[0]?.startsWith('https://')) { const optionsUrl = new URL(options?.[0]); // using async to avoid rendering if (optionsUrl.hostname.endsWith('hlx.page') - || optionsUrl.hostname.endsWith('hlx.live')) { + || optionsUrl.hostname.endsWith('hlx.live')) { fetch(`${optionsUrl.pathname}${optionsUrl.search}`) .then(async (response) => { const json = await response.json(); @@ -304,6 +304,10 @@ function inputDecorator(field, element) { input.disabled = true; } const fieldType = getHTMLRenderType(field); + if (['tel', 'email'].includes(fieldType)) { + input.type = fieldType; + input.inputMode = fieldType; + } if (['number', 'date', 'text', 'email'].includes(fieldType) && (field.displayFormat || field.displayValueExpression)) { field.type = fieldType; input.setAttribute('edit-value', field.value ?? ''); diff --git a/blocks/form/models/form-components/_telephone-input.json b/blocks/form/models/form-components/_telephone-input.json index bd2963091f..912bb38573 100644 --- a/blocks/form/models/form-components/_telephone-input.json +++ b/blocks/form/models/form-components/_telephone-input.json @@ -8,7 +8,8 @@ "page": { "resourceType": "core/fd/components/form/telephoneinput/v1/telephoneinput", "template": { - "jcr:title": "Telephone Input" + "jcr:title": "Telephone Input", + "fieldType": "tel" } } } diff --git a/component-definition.json b/component-definition.json index 939d84333f..6b7f7eed2d 100644 --- a/component-definition.json +++ b/component-definition.json @@ -417,7 +417,8 @@ "page": { "resourceType": "core/fd/components/form/telephoneinput/v1/telephoneinput", "template": { - "jcr:title": "Telephone Input" + "jcr:title": "Telephone Input", + "fieldType": "tel" } } } diff --git a/test/unit/fixtures/components/accordion/accordion.html b/test/unit/fixtures/components/accordion/accordion.html index 565b138273..c09612841c 100644 --- a/test/unit/fixtures/components/accordion/accordion.html +++ b/test/unit/fixtures/components/accordion/accordion.html @@ -2,7 +2,7 @@