@chat21/chat21-web-widget 5.1.32-rc8 → 5.1.33-rc11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/.angular-mcp-cache/package.json +1 -0
  2. package/.cursor/angular18-accessibility-auditor-skill.md +442 -0
  3. package/.cursor/mcp.json +15 -0
  4. package/.github/workflows/playwright.yml +27 -0
  5. package/.playwright-mcp/console-2026-05-08T15-31-09-000Z.log +17 -0
  6. package/.playwright-mcp/console-2026-05-08T15-32-19-412Z.log +89 -0
  7. package/.playwright-mcp/console-2026-05-08T16-18-48-424Z.log +133 -0
  8. package/.playwright-mcp/console-2026-05-11T12-54-06-869Z.log +13 -0
  9. package/.playwright-mcp/console-2026-05-11T12-54-56-229Z.log +147 -0
  10. package/.playwright-mcp/console-2026-05-11T12-55-47-174Z.log +183 -0
  11. package/.playwright-mcp/console-2026-05-11T15-34-03-590Z.log +210 -0
  12. package/.playwright-mcp/console-2026-05-12T15-07-31-880Z.log +118 -0
  13. package/.playwright-mcp/page-2026-05-08T15-32-19-900Z.yml +851 -0
  14. package/.playwright-mcp/page-2026-05-08T15-32-47-264Z.yml +857 -0
  15. package/.playwright-mcp/page-2026-05-08T15-33-17-089Z.yml +1110 -0
  16. package/.playwright-mcp/page-2026-05-08T15-33-23-486Z.yml +1069 -0
  17. package/.playwright-mcp/page-2026-05-08T15-33-45-390Z.yml +1076 -0
  18. package/.playwright-mcp/page-2026-05-08T15-33-52-666Z.yml +1072 -0
  19. package/.playwright-mcp/page-2026-05-08T15-34-01-338Z.yml +1085 -0
  20. package/.playwright-mcp/page-2026-05-08T15-34-07-227Z.yml +1072 -0
  21. package/.playwright-mcp/page-2026-05-08T15-34-13-875Z.yml +1072 -0
  22. package/.playwright-mcp/page-2026-05-08T15-34-21-885Z.yml +1109 -0
  23. package/.playwright-mcp/page-2026-05-08T15-34-32-755Z.yml +1109 -0
  24. package/.playwright-mcp/page-2026-05-08T15-35-09-607Z.yml +1119 -0
  25. package/.playwright-mcp/page-2026-05-08T15-35-14-242Z.yml +1109 -0
  26. package/.playwright-mcp/page-2026-05-08T16-18-48-671Z.yml +44 -0
  27. package/.playwright-mcp/page-2026-05-08T16-18-52-753Z.png +0 -0
  28. package/.playwright-mcp/page-2026-05-08T16-19-13-919Z.yml +68 -0
  29. package/.playwright-mcp/page-2026-05-08T16-19-17-977Z.png +0 -0
  30. package/.playwright-mcp/page-2026-05-08T16-19-25-733Z.yml +120 -0
  31. package/.playwright-mcp/page-2026-05-08T16-19-29-252Z.png +0 -0
  32. package/.playwright-mcp/page-2026-05-08T16-19-39-269Z.yml +80 -0
  33. package/.playwright-mcp/page-2026-05-08T16-19-43-915Z.png +0 -0
  34. package/.playwright-mcp/page-2026-05-08T16-20-04-407Z.yml +81 -0
  35. package/.playwright-mcp/page-2026-05-08T16-20-08-984Z.png +0 -0
  36. package/.playwright-mcp/page-2026-05-08T16-20-32-397Z.png +0 -0
  37. package/.playwright-mcp/page-2026-05-08T16-20-58-658Z.png +0 -0
  38. package/.playwright-mcp/page-2026-05-08T16-21-12-320Z.yml +86 -0
  39. package/.playwright-mcp/page-2026-05-08T16-21-39-154Z.yml +91 -0
  40. package/.playwright-mcp/page-2026-05-08T16-21-45-420Z.png +0 -0
  41. package/.playwright-mcp/page-2026-05-08T16-22-21-062Z.yml +0 -0
  42. package/.playwright-mcp/page-2026-05-08T16-22-58-232Z.yml +91 -0
  43. package/.playwright-mcp/page-2026-05-08T16-23-36-520Z.yml +0 -0
  44. package/.playwright-mcp/page-2026-05-08T16-23-46-805Z.yml +100 -0
  45. package/.playwright-mcp/page-2026-05-08T16-23-55-169Z.png +0 -0
  46. package/.playwright-mcp/page-2026-05-08T16-24-26-574Z.yml +91 -0
  47. package/.playwright-mcp/page-2026-05-08T16-25-34-414Z.png +0 -0
  48. package/.playwright-mcp/page-2026-05-08T16-25-59-831Z.png +0 -0
  49. package/.playwright-mcp/page-2026-05-08T16-26-21-809Z.yml +91 -0
  50. package/.playwright-mcp/page-2026-05-08T16-26-47-443Z.yml +105 -0
  51. package/.playwright-mcp/page-2026-05-08T16-26-56-136Z.png +0 -0
  52. package/.playwright-mcp/page-2026-05-08T16-27-59-610Z.yml +48 -0
  53. package/.playwright-mcp/page-2026-05-11T12-54-07-180Z.yml +44 -0
  54. package/.playwright-mcp/page-2026-05-11T12-54-56-946Z.yml +4 -0
  55. package/.playwright-mcp/page-2026-05-11T12-55-47-503Z.yml +24 -0
  56. package/.playwright-mcp/page-2026-05-11T12-56-00-766Z.yml +28 -0
  57. package/.playwright-mcp/page-2026-05-11T12-56-06-438Z.yml +90 -0
  58. package/.playwright-mcp/page-2026-05-11T12-57-56-838Z.yml +106 -0
  59. package/.playwright-mcp/page-2026-05-11T12-58-00-124Z.yml +106 -0
  60. package/.playwright-mcp/page-2026-05-11T12-59-08-836Z.yml +61 -0
  61. package/.playwright-mcp/page-2026-05-11T12-59-12-088Z.yml +61 -0
  62. package/.playwright-mcp/page-2026-05-11T12-59-26-215Z.yml +69 -0
  63. package/.playwright-mcp/page-2026-05-11T12-59-29-519Z.yml +69 -0
  64. package/.playwright-mcp/page-2026-05-11T12-59-37-309Z.yml +0 -0
  65. package/.playwright-mcp/page-2026-05-11T12-59-39-968Z.yml +79 -0
  66. package/.playwright-mcp/page-2026-05-11T12-59-45-983Z.yml +78 -0
  67. package/.playwright-mcp/page-2026-05-11T12-59-49-951Z.yml +78 -0
  68. package/.playwright-mcp/page-2026-05-11T15-34-04-515Z.yml +0 -0
  69. package/.playwright-mcp/page-2026-05-12T15-07-32-171Z.yml +44 -0
  70. package/.playwright-mcp/page-2026-05-12T15-08-09-820Z.yml +119 -0
  71. package/CHANGELOG.md +68 -3
  72. package/angular.json +20 -3
  73. package/deploy_amazon_beta.sh +7 -17
  74. package/deploy_amazon_prod.sh +41 -0
  75. package/docs/TILEDESK_WIDGET_ACCESSIBILITY_STATEMENT_COMPLETE.md +379 -0
  76. package/env.sample +3 -2
  77. package/mocks/voice-websocket-mock/server.cjs +245 -0
  78. package/package.json +7 -3
  79. package/playwright.config.ts +41 -0
  80. package/src/app/app.component.html +2 -2
  81. package/src/app/app.component.scss +25 -14
  82. package/src/app/app.component.spec.ts +21 -6
  83. package/src/app/app.module.ts +4 -0
  84. package/src/app/component/conversation-detail/conversation/conversation.component.html +19 -11
  85. package/src/app/component/conversation-detail/conversation/conversation.component.scss +28 -0
  86. package/src/app/component/conversation-detail/conversation/conversation.component.spec.ts +644 -75
  87. package/src/app/component/conversation-detail/conversation/conversation.component.ts +63 -17
  88. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.html +25 -13
  89. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.spec.ts +123 -5
  90. package/src/app/component/conversation-detail/conversation-audio-recorder/conversation-audio-recorder.component.ts +1 -0
  91. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.html +22 -9
  92. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.scss +23 -1
  93. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.spec.ts +242 -149
  94. package/src/app/component/conversation-detail/conversation-content/conversation-content.component.ts +7 -6
  95. package/src/app/component/conversation-detail/conversation-emojii/conversation-emojii.component.spec.ts +53 -3
  96. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component copy.html +172 -0
  97. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.html +112 -61
  98. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.scss +133 -16
  99. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.spec.ts +452 -78
  100. package/src/app/component/conversation-detail/conversation-footer/conversation-footer.component.ts +199 -79
  101. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.html +113 -53
  102. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.scss +12 -4
  103. package/src/app/component/conversation-detail/conversation-header/conversation-header.component.spec.ts +274 -29
  104. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.html +23 -9
  105. package/src/app/component/conversation-detail/conversation-internal-frame/conversation-internal-frame.component.spec.ts +80 -8
  106. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.html +29 -23
  107. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.spec.ts +185 -16
  108. package/src/app/component/conversation-detail/conversation-preview/conversation-preview.component.ts +34 -14
  109. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.html +46 -19
  110. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.scss +67 -10
  111. package/src/app/component/conversation-detail/stream-audio-spectrum/stream-audio-spectrum.component.ts +142 -12
  112. package/src/app/component/error-alert/error-alert.component.spec.ts +65 -5
  113. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.html +16 -7
  114. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.scss +21 -0
  115. package/src/app/component/eyeeye-catcher-card/eyeeye-catcher-card.component.spec.ts +89 -7
  116. package/src/app/component/form/form-builder/form-builder.component.html +1 -1
  117. package/src/app/component/form/form-builder/form-builder.component.spec.ts +163 -21
  118. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.html +8 -4
  119. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.scss +10 -5
  120. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.spec.ts +90 -16
  121. package/src/app/component/form/inputs/form-checkbox/form-checkbox.component.ts +26 -0
  122. package/src/app/component/form/inputs/form-label/form-label.component.spec.ts +45 -11
  123. package/src/app/component/form/inputs/form-radio-button/form-radio-button.component.spec.ts +24 -6
  124. package/src/app/component/form/inputs/form-select/form-select.component.spec.ts +14 -5
  125. package/src/app/component/form/inputs/form-text/form-text.component.html +14 -12
  126. package/src/app/component/form/inputs/form-text/form-text.component.scss +11 -1
  127. package/src/app/component/form/inputs/form-text/form-text.component.spec.ts +113 -17
  128. package/src/app/component/form/inputs/form-text/form-text.component.ts +35 -3
  129. package/src/app/component/form/inputs/form-textarea/form-textarea.component.html +13 -11
  130. package/src/app/component/form/inputs/form-textarea/form-textarea.component.scss +6 -5
  131. package/src/app/component/form/inputs/form-textarea/form-textarea.component.spec.ts +149 -13
  132. package/src/app/component/form/inputs/form-textarea/form-textarea.component.ts +26 -0
  133. package/src/app/component/form/prechat-form/prechat-form.component.html +14 -11
  134. package/src/app/component/form/prechat-form/prechat-form.component.spec.ts +102 -10
  135. package/src/app/component/form/prechat-form/prechat-form.component.ts +8 -1
  136. package/src/app/component/form/prechat-form-test-mock.ts +35 -0
  137. package/src/app/component/home/home.component.html +38 -31
  138. package/src/app/component/home/home.component.scss +4 -2
  139. package/src/app/component/home/home.component.spec.ts +226 -11
  140. package/src/app/component/home-conversations/home-conversations.component.html +30 -26
  141. package/src/app/component/home-conversations/home-conversations.component.scss +3 -0
  142. package/src/app/component/home-conversations/home-conversations.component.spec.ts +212 -36
  143. package/src/app/component/last-message/last-message.component.html +15 -9
  144. package/src/app/component/last-message/last-message.component.scss +16 -2
  145. package/src/app/component/last-message/last-message.component.spec.ts +204 -23
  146. package/src/app/component/launcher-button/launcher-button.component.html +8 -13
  147. package/src/app/component/launcher-button/launcher-button.component.spec.ts +104 -8
  148. package/src/app/component/list-all-conversations/list-all-conversations.component.html +12 -17
  149. package/src/app/component/list-all-conversations/list-all-conversations.component.scss +2 -0
  150. package/src/app/component/list-conversations/list-conversations.component.html +22 -22
  151. package/src/app/component/menu-options/menu-options.component.html +30 -20
  152. package/src/app/component/menu-options/menu-options.component.spec.ts +125 -9
  153. package/src/app/component/message/audio/audio.component.html +13 -15
  154. package/src/app/component/message/audio/audio.component.spec.ts +140 -5
  155. package/src/app/component/message/audio/audio.component.ts +1 -0
  156. package/src/app/component/message/audio-sync/audio-sync.component.scss +1 -1
  157. package/src/app/component/message/audio-sync/audio-sync.component.spec.ts +81 -1
  158. package/src/app/component/message/audio-sync/audio-sync.component.ts +134 -24
  159. package/src/app/component/message/avatar/avatar.component.html +2 -2
  160. package/src/app/component/message/avatar/avatar.component.spec.ts +99 -7
  161. package/src/app/component/message/bubble-message/bubble-message.component.html +39 -52
  162. package/src/app/component/message/bubble-message/bubble-message.component.scss +59 -1
  163. package/src/app/component/message/bubble-message/bubble-message.component.spec.ts +154 -57
  164. package/src/app/component/message/bubble-message/bubble-message.component.ts +152 -110
  165. package/src/app/component/message/buttons/action-button/action-button.component.html +3 -4
  166. package/src/app/component/message/buttons/action-button/action-button.component.spec.ts +49 -5
  167. package/src/app/component/message/buttons/link-button/link-button.component.scss +5 -8
  168. package/src/app/component/message/buttons/link-button/link-button.component.spec.ts +50 -5
  169. package/src/app/component/message/buttons/text-button/text-button.component.spec.ts +44 -5
  170. package/src/app/component/message/carousel/carousel.component.html +29 -16
  171. package/src/app/component/message/carousel/carousel.component.scss +20 -8
  172. package/src/app/component/message/carousel/carousel.component.spec.ts +80 -3
  173. package/src/app/component/message/carousel/carousel.component.ts +16 -0
  174. package/src/app/component/message/frame/frame.component.html +9 -4
  175. package/src/app/component/message/frame/frame.component.spec.ts +34 -15
  176. package/src/app/component/message/frame/frame.component.ts +7 -2
  177. package/src/app/component/message/html/html.component.html +1 -1
  178. package/src/app/component/message/html/html.component.scss +1 -1
  179. package/src/app/component/message/html/html.component.spec.ts +24 -7
  180. package/src/app/component/message/image/image.component.html +12 -10
  181. package/src/app/component/message/image/image.component.scss +16 -0
  182. package/src/app/component/message/image/image.component.spec.ts +101 -15
  183. package/src/app/component/message/image/image.component.ts +90 -51
  184. package/src/app/component/message/info-message/info-message.component.spec.ts +26 -14
  185. package/src/app/component/message/json-sources/json-sources.component.html +38 -0
  186. package/src/app/component/message/json-sources/json-sources.component.scss +201 -0
  187. package/src/app/component/message/json-sources/json-sources.component.ts +89 -0
  188. package/src/app/component/message/like-unlike/like-unlike.component.html +7 -9
  189. package/src/app/component/message/like-unlike/like-unlike.component.spec.ts +31 -3
  190. package/src/app/component/message/return-receipt/return-receipt.component.spec.ts +38 -17
  191. package/src/app/component/message/text/text.component.html +3 -3
  192. package/src/app/component/message/text/text.component.scss +80 -86
  193. package/src/app/component/message/text/text.component.spec.ts +106 -13
  194. package/src/app/component/message-attachment/message-attachment.component.spec.ts +134 -13
  195. package/src/app/component/selection-department/selection-department.component.html +21 -23
  196. package/src/app/component/selection-department/selection-department.component.spec.ts +159 -14
  197. package/src/app/component/selection-department/selection-department.component.ts +8 -1
  198. package/src/app/component/send-button/send-button.component.html +5 -13
  199. package/src/app/component/send-button/send-button.component.spec.ts +2 -2
  200. package/src/app/component/star-rating-widget/star-rating-widget.component.html +51 -81
  201. package/src/app/directives/tooltip.directive.spec.ts +8 -4
  202. package/src/app/modals/confirm-close/confirm-close.component.html +20 -8
  203. package/src/app/modals/confirm-close/confirm-close.component.scss +3 -0
  204. package/src/app/modals/confirm-close/confirm-close.component.spec.ts +13 -4
  205. package/src/app/modals/confirm-close/confirm-close.component.ts +8 -1
  206. package/src/app/pipe/html-entites-encode.pipe.spec.ts +35 -2
  207. package/src/app/pipe/marked.pipe.spec.ts +38 -2
  208. package/src/app/pipe/marked.pipe.ts +51 -41
  209. package/src/app/providers/app-config.service.ts +4 -2
  210. package/src/app/providers/brand.service.spec.ts +23 -2
  211. package/src/app/providers/brand.service.ts +1 -1
  212. package/src/app/providers/global-settings.service.spec.ts +1009 -14
  213. package/src/app/providers/global-settings.service.ts +59 -2
  214. package/src/app/providers/json-sources-parser.service.ts +175 -0
  215. package/src/app/providers/translator.service.ts +24 -6
  216. package/src/app/providers/tts-audio-playback-coordinator.service.spec.ts +117 -0
  217. package/src/app/providers/tts-audio-playback-coordinator.service.ts +45 -7
  218. package/src/app/providers/url-preview.service.ts +82 -0
  219. package/src/app/providers/voice/audio.types.ts +6 -0
  220. package/src/app/providers/voice/voice-streaming.service.spec.ts +23 -0
  221. package/src/app/providers/voice/voice-streaming.service.ts +702 -0
  222. package/src/app/providers/voice/voice-streaming.types.ts +112 -0
  223. package/src/app/providers/voice/voice.service.spec.ts +170 -3
  224. package/src/app/providers/voice/voice.service.ts +695 -16
  225. package/src/app/sass/_variables.scss +1 -1
  226. package/src/app/sass/animations.scss +19 -1
  227. package/src/app/utils/globals.ts +14 -0
  228. package/src/app/utils/json-sources-utils.ts +27 -0
  229. package/src/app/utils/url-utils.ts +98 -0
  230. package/src/app/utils/utils-resources.ts +1 -1
  231. package/src/assets/i18n/en.json +106 -100
  232. package/src/assets/i18n/es.json +107 -101
  233. package/src/assets/i18n/fr.json +107 -101
  234. package/src/assets/i18n/it.json +107 -99
  235. package/src/assets/sounds/keyboard.mp3 +0 -0
  236. package/src/assets/twp/index-dev.html +18 -0
  237. package/src/assets/twp/tiledesk_widget_files/widget-css-override-example.css +14 -0
  238. package/src/chat21-core/providers/chat-manager.spec.ts +72 -0
  239. package/src/chat21-core/providers/scripts/script.service.spec.ts +12 -2
  240. package/src/chat21-core/utils/constants.ts +4 -0
  241. package/src/chat21-core/utils/utils-message.ts +23 -1
  242. package/src/widget-config-template.json +3 -1
  243. package/src/widget-config.json +28 -27
  244. package/tests/widget-form-rich.spec.ts +67 -0
  245. package/tests/widget-index-dev-settings.spec.ts +52 -0
  246. package/tests/widget-twp-iframe.spec.ts +39 -0
@@ -1,30 +1,104 @@
1
- import { style } from '@angular/animations';
2
- import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
3
- import { FormGroupDirective } from '@angular/forms';
1
+ import { Component } from '@angular/core';
2
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
3
+ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
4
+ import { By } from '@angular/platform-browser';
4
5
 
6
+ import { FormArray } from 'src/chat21-core/models/formArray';
5
7
  import { FormCheckboxComponent } from './form-checkbox.component';
6
8
 
9
+ @Component({
10
+ template: `
11
+ <form [formGroup]="form">
12
+ <chat-form-checkbox
13
+ [element]="element"
14
+ controlName="acceptTerms"
15
+ [translationErrorLabelMap]="translationErrorLabelMap"
16
+ [stylesMap]="stylesMap"
17
+ [hasSubmitted]="hasSubmitted"
18
+ ></chat-form-checkbox>
19
+ </form>`,
20
+ })
21
+ class FormCheckboxHostComponent {
22
+ form = new FormBuilder().group({
23
+ acceptTerms: [false, [Validators.requiredTrue]],
24
+ });
25
+ element = {
26
+ name: 'acceptTerms',
27
+ type: 'checkbox',
28
+ text: 'I accept the terms',
29
+ mandatory: true,
30
+ tabIndex: 1500,
31
+ } as FormArray;
32
+ stylesMap = new Map<string, string>([
33
+ ['themeColor', '#2a6ac1'],
34
+ ['foregroundColor', '#ffffff'],
35
+ ]);
36
+ translationErrorLabelMap = new Map<string, string>([
37
+ ['LABEL_ERROR_FIELD_REQUIRED', 'You must accept'],
38
+ ]);
39
+ hasSubmitted = false;
40
+ }
41
+
7
42
  describe('FormCheckboxComponent', () => {
8
- let component: FormCheckboxComponent;
9
- let fixture: ComponentFixture<FormCheckboxComponent>;
10
- let stylesMap = new Map<string, string>();
43
+ let fixture: ComponentFixture<FormCheckboxHostComponent>;
44
+ let host: FormCheckboxHostComponent;
45
+
11
46
  beforeEach(waitForAsync(() => {
12
47
  TestBed.configureTestingModule({
13
- declarations: [ FormCheckboxComponent ],
14
- providers: [ FormGroupDirective ]
15
- })
16
- .compileComponents();
48
+ declarations: [FormCheckboxHostComponent, FormCheckboxComponent],
49
+ imports: [ReactiveFormsModule],
50
+ }).compileComponents();
17
51
  }));
18
52
 
19
53
  beforeEach(() => {
20
- fixture = TestBed.createComponent(FormCheckboxComponent);
21
- component = fixture.componentInstance;
22
- component.stylesMap = stylesMap.set('themeColor', "#2a6ac1")
23
- .set('foregroundColor', "#ffffff")
54
+ fixture = TestBed.createComponent(FormCheckboxHostComponent);
55
+ host = fixture.componentInstance;
56
+ fixture.detectChanges();
57
+ });
58
+
59
+ it('should create with checkbox wired to label for=id', () => {
60
+ const box = fixture.nativeElement.querySelector(
61
+ 'input#c21-prechat-acceptTerms',
62
+ ) as HTMLInputElement;
63
+ expect(box.type).toBe('checkbox');
64
+ const label = fixture.nativeElement.querySelector(
65
+ 'label[for="c21-prechat-acceptTerms"]',
66
+ ) as HTMLLabelElement;
67
+ expect(label.textContent?.trim()).toBe('I accept the terms');
68
+ });
69
+
70
+ it('should expose aria-invalid after submit when still unchecked', () => {
71
+ host.hasSubmitted = true;
24
72
  fixture.detectChanges();
73
+ const box = fixture.nativeElement.querySelector(
74
+ 'input#c21-prechat-acceptTerms',
75
+ ) as HTMLInputElement;
76
+ expect(box.getAttribute('aria-invalid')).toBe('true');
77
+ expect(box.getAttribute('aria-describedby')).toBe('c21-prechat-acceptTerms-errors');
78
+ const alert = fixture.nativeElement.querySelector(
79
+ '#c21-prechat-acceptTerms-errors',
80
+ ) as HTMLElement;
81
+ expect(alert.textContent).toContain('You must accept');
82
+ });
83
+
84
+ it('onEnterPressed should bubble intent to parent form-builder via output', () => {
85
+ const inner = fixture.debugElement.query(By.directive(FormCheckboxComponent))
86
+ .componentInstance as FormCheckboxComponent;
87
+ spyOn(inner.onKeyEnterPressed, 'emit');
88
+ inner.onEnterPressed(new KeyboardEvent('keydown', { key: 'Enter' }));
89
+ expect(inner.onKeyEnterPressed.emit).toHaveBeenCalled();
90
+ });
91
+
92
+ it('ariaInvalid should be false before first submit', () => {
93
+ const inner = fixture.debugElement.query(By.directive(FormCheckboxComponent))
94
+ .componentInstance as FormCheckboxComponent;
95
+ expect(inner.ariaInvalid).toBe('false');
25
96
  });
26
97
 
27
- it('should create', () => {
28
- expect(component).toBeTruthy();
98
+ it('fieldBaseId should sanitize special characters in name', () => {
99
+ const inner = fixture.debugElement.query(By.directive(FormCheckboxComponent))
100
+ .componentInstance as FormCheckboxComponent;
101
+ inner.element = { name: 'a/b', text: 'x' } as FormArray;
102
+ expect(inner.fieldBaseId).toBe('c21-prechat-a_b');
29
103
  });
30
104
  });
@@ -17,6 +17,32 @@ export class FormCheckboxComponent implements OnInit {
17
17
  @Output() onKeyEnterPressed = new EventEmitter<any>();
18
18
 
19
19
  form: FormGroup<any>;
20
+
21
+ get fieldBaseId(): string {
22
+ const raw = this.element?.name || this.controlName || 'field';
23
+ return 'c21-prechat-' + String(raw).replace(/[^a-zA-Z0-9_-]/g, '_');
24
+ }
25
+
26
+ get errorsId(): string {
27
+ return this.fieldBaseId + '-errors';
28
+ }
29
+
30
+ get ariaDescribedByErrors(): string | null {
31
+ const name = this.element?.name;
32
+ if (!this.hasSubmitted || !this.form?.controls?.[name]?.errors) {
33
+ return null;
34
+ }
35
+ return this.errorsId;
36
+ }
37
+
38
+ get ariaInvalid(): 'true' | 'false' {
39
+ const name = this.element?.name;
40
+ if (!this.hasSubmitted || !this.form?.controls?.[name]) {
41
+ return 'false';
42
+ }
43
+ return this.form.controls[name].invalid ? 'true' : 'false';
44
+ }
45
+
20
46
  constructor(private rootFormGroup: FormGroupDirective,
21
47
  private elementRef: ElementRef) { }
22
48
 
@@ -1,27 +1,61 @@
1
+ import { Component } from '@angular/core';
1
2
  import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
- import { FormGroupDirective } from '@angular/forms';
3
+ import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
4
+ import { By } from '@angular/platform-browser';
3
5
 
6
+ import { FormArray } from 'src/chat21-core/models/formArray';
4
7
  import { FormLabelComponent } from './form-label.component';
5
8
 
9
+ @Component({
10
+ template: `
11
+ <form [formGroup]="form">
12
+ <chat-form-label
13
+ [element]="element"
14
+ controlName="intro"
15
+ [hasSubmitted]="hasSubmitted"
16
+ ></chat-form-label>
17
+ </form>`,
18
+ })
19
+ class FormLabelHostComponent {
20
+ form = new FormBuilder().group({});
21
+ hasSubmitted = false;
22
+ element = {
23
+ name: 'intro',
24
+ type: 'static',
25
+ text: '<strong>Welcome</strong> to support',
26
+ tabIndex: 0,
27
+ } as FormArray;
28
+ }
29
+
6
30
  describe('FormLabelComponent', () => {
7
- let component: FormLabelComponent;
8
- let fixture: ComponentFixture<FormLabelComponent>;
31
+ let fixture: ComponentFixture<FormLabelHostComponent>;
9
32
 
10
33
  beforeEach(waitForAsync(() => {
11
34
  TestBed.configureTestingModule({
12
- declarations: [ FormLabelComponent ],
13
- providers: [ FormGroupDirective ]
14
- })
15
- .compileComponents();
35
+ declarations: [FormLabelHostComponent, FormLabelComponent],
36
+ imports: [ReactiveFormsModule],
37
+ }).compileComponents();
16
38
  }));
17
39
 
18
40
  beforeEach(() => {
19
- fixture = TestBed.createComponent(FormLabelComponent);
20
- component = fixture.componentInstance;
41
+ fixture = TestBed.createComponent(FormLabelHostComponent);
21
42
  fixture.detectChanges();
22
43
  });
23
44
 
24
- it('should create', () => {
25
- expect(component).toBeTruthy();
45
+ it('should create and bind innerHTML from static field text', () => {
46
+ const host = fixture.nativeElement.querySelector('.c21-header-label label') as HTMLElement;
47
+ expect(host.innerHTML).toContain('<strong>Welcome</strong>');
48
+ });
49
+
50
+ it('should assign tabindex from element', () => {
51
+ const host = fixture.nativeElement.querySelector('.c21-header-label label') as HTMLElement;
52
+ expect(host.getAttribute('tabindex')).toBe('0');
53
+ });
54
+
55
+ it('should wire FormGroup from parent via FormGroupDirective', () => {
56
+ const inner = fixture.componentInstance;
57
+ const labelComp = fixture.debugElement.query(By.directive(FormLabelComponent))
58
+ .componentInstance as FormLabelComponent;
59
+ expect(labelComp.form).toBe(inner.form);
26
60
  });
27
61
  });
@@ -1,16 +1,15 @@
1
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
1
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
2
 
3
3
  import { FormRadioButtonComponent } from './form-radio-button.component';
4
4
 
5
- describe('RadioButtonComponent', () => {
5
+ describe('FormRadioButtonComponent', () => {
6
6
  let component: FormRadioButtonComponent;
7
7
  let fixture: ComponentFixture<FormRadioButtonComponent>;
8
8
 
9
- beforeEach(async(() => {
9
+ beforeEach(waitForAsync(() => {
10
10
  TestBed.configureTestingModule({
11
- declarations: [ FormRadioButtonComponent ]
12
- })
13
- .compileComponents();
11
+ declarations: [FormRadioButtonComponent],
12
+ }).compileComponents();
14
13
  }));
15
14
 
16
15
  beforeEach(() => {
@@ -22,4 +21,23 @@ describe('RadioButtonComponent', () => {
22
21
  it('should create', () => {
23
22
  expect(component).toBeTruthy();
24
23
  });
24
+
25
+ it('should render two radio inputs sharing a name for single-choice semantics', () => {
26
+ const radios = fixture.nativeElement.querySelectorAll(
27
+ 'input[type="radio"]',
28
+ ) as NodeListOf<HTMLInputElement>;
29
+ expect(radios.length).toBe(2);
30
+ expect(radios[0].name).toBe(radios[1].name);
31
+ });
32
+
33
+ it('should associate each radio with a label via for/id', () => {
34
+ const r1 = fixture.nativeElement.querySelector('#flexRadioDefault1') as HTMLInputElement;
35
+ const r2 = fixture.nativeElement.querySelector('#flexRadioDefault2') as HTMLInputElement;
36
+ const l1 = fixture.nativeElement.querySelector('label[for="flexRadioDefault1"]') as HTMLLabelElement;
37
+ const l2 = fixture.nativeElement.querySelector('label[for="flexRadioDefault2"]') as HTMLLabelElement;
38
+ expect(l1).toBeTruthy();
39
+ expect(l2).toBeTruthy();
40
+ expect(r2.checked).toBe(true);
41
+ expect(r1.checked).toBe(false);
42
+ });
25
43
  });
@@ -1,15 +1,15 @@
1
- import {ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
1
+ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+
2
3
  import { FormSelectComponent } from './form-select.component';
3
4
 
4
- describe('SelectComponent', () => {
5
+ describe('FormSelectComponent', () => {
5
6
  let component: FormSelectComponent;
6
7
  let fixture: ComponentFixture<FormSelectComponent>;
7
8
 
8
9
  beforeEach(waitForAsync(() => {
9
10
  TestBed.configureTestingModule({
10
- declarations: [ FormSelectComponent ]
11
- })
12
- .compileComponents();
11
+ declarations: [FormSelectComponent],
12
+ }).compileComponents();
13
13
  }));
14
14
 
15
15
  beforeEach(() => {
@@ -21,4 +21,13 @@ describe('SelectComponent', () => {
21
21
  it('should create', () => {
22
22
  expect(component).toBeTruthy();
23
23
  });
24
+
25
+ it('should render placeholder copy until a real select is implemented', () => {
26
+ const p = fixture.nativeElement.querySelector('p') as HTMLParagraphElement;
27
+ expect(p.textContent?.trim()).toBe('select works!');
28
+ });
29
+
30
+ it('ngOnInit should complete without throwing', () => {
31
+ expect(() => component.ngOnInit()).not.toThrow();
32
+ });
24
33
  });
@@ -1,23 +1,25 @@
1
1
  <form [formGroup]="form">
2
- <div class="form-group label-floating"
2
+ <div class="form-group label-floating"
3
3
  [ngClass]="{'is-empty': !form?.controls[element.name].value}"
4
- id="div_input" #div_input>
5
- <label class="control-label">
4
+ [id]="'wrap-' + fieldBaseId" #div_input>
5
+ <label class="control-label" [attr.for]="fieldBaseId">
6
6
  {{element?.text}}
7
7
  </label>
8
- <input
9
- [formControlName]="element?.name"
8
+ <input
9
+ [id]="fieldBaseId"
10
+ [formControlName]="element?.name"
10
11
  [type]="inputType"
11
12
  [tabIndex]="element?.tabIndex"
12
- class="form-control"
13
+ class="form-control"
13
14
  [class.errors]="form?.controls[element?.name].errors && hasSubmitted"
14
- (keydown.enter)="onEnterPressed($event)"
15
+ [attr.aria-required]="element?.mandatory ? 'true' : null"
16
+ [attr.aria-invalid]="ariaInvalid"
17
+ [attr.aria-describedby]="ariaDescribedByErrors"
18
+ (keydown.enter)="onEnterPressed($event)"
15
19
  (focus)="onFocus()" (focusout)="onFocusOut()">
16
20
  </div>
17
- <div *ngIf="hasSubmitted && form?.controls[element?.name].errors && form?.controls[element?.name].hasError('required')" class="text-danger">
18
- {{translationErrorLabelMap?.get('LABEL_ERROR_FIELD_REQUIRED')}}
19
- </div>
20
- <div *ngIf="hasSubmitted && form?.controls[element?.name].errors && form?.controls[element?.name].hasError('pattern') && element?.errorLabel" class="text-danger">
21
- {{element?.errorLabel}}
21
+ <div [id]="errorsId" *ngIf="hasSubmitted && form?.controls[element?.name]?.errors" class="text-danger" role="alert">
22
+ <span *ngIf="form?.controls[element?.name].hasError('required')">{{translationErrorLabelMap?.get('LABEL_ERROR_FIELD_REQUIRED')}}</span>
23
+ <span *ngIf="form?.controls[element?.name].hasError('pattern') && element?.errorLabel">{{element?.errorLabel}}</span>
22
24
  </div>
23
25
  </form>
@@ -41,7 +41,7 @@
41
41
  }
42
42
 
43
43
  /* Remove input border colour */
44
- input:focus,
44
+ input:focus:not(:focus-visible),
45
45
  input:active,
46
46
  input:hover,
47
47
  input:visited {
@@ -49,6 +49,11 @@
49
49
  background-color: #ffffff;
50
50
  outline: none;
51
51
  }
52
+
53
+ input:focus-visible {
54
+ outline: 2px solid var(--themeColor, #1a73e8);
55
+ outline-offset: 2px;
56
+ }
52
57
 
53
58
  /* Remove input background colour for Chrome autocomplete */
54
59
  input:-webkit-autofill,
@@ -179,6 +184,11 @@ input {
179
184
  transition-duration: 0.3s;
180
185
  }
181
186
 
187
+ .form-group.is-focused .form-control:focus-visible {
188
+ outline: 2px solid var(--themeColor, #1a73e8) !important;
189
+ outline-offset: 2px;
190
+ }
191
+
182
192
  .form-group.is-focused.form-info .form-control {
183
193
  background-image: linear-gradient(#00bcd4, #00bcd4), linear-gradient(#D2D2D2, #D2D2D2);
184
194
  }
@@ -1,31 +1,127 @@
1
+ import { Component } from '@angular/core';
1
2
  import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
- import { FormGroupDirective } from '@angular/forms';
3
+ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
4
+ import { By } from '@angular/platform-browser';
3
5
 
6
+ import { FormArray } from 'src/chat21-core/models/formArray';
7
+ import { clonePrechatFormJsonMock } from '../../prechat-form-test-mock';
4
8
  import { FormTextComponent } from './form-text.component';
5
9
 
10
+ @Component({
11
+ template: `
12
+ <form [formGroup]="form">
13
+ <chat-form-text
14
+ [element]="element"
15
+ [controlName]="controlName"
16
+ [translationErrorLabelMap]="translationErrorLabelMap"
17
+ [stylesMap]="stylesMap"
18
+ [hasSubmitted]="hasSubmitted"
19
+ ></chat-form-text>
20
+ </form>`,
21
+ })
22
+ class FormTextHostComponent {
23
+ form = new FormBuilder().group({
24
+ userFullname: ['', Validators.required],
25
+ userEmail: ['', [Validators.required, Validators.pattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)]],
26
+ });
27
+ controlName = 'userFullname';
28
+ element = {
29
+ name: 'userFullname',
30
+ type: 'text',
31
+ mandatory: true,
32
+ text: 'User fullname',
33
+ tabIndex: 1411,
34
+ } as FormArray;
35
+ stylesMap = new Map<string, string>([
36
+ ['themeColor', '#2a6ac1'],
37
+ ['foregroundColor', '#ffffff'],
38
+ ]);
39
+ translationErrorLabelMap = new Map<string, string>([
40
+ ['LABEL_ERROR_FIELD_REQUIRED', 'Required field'],
41
+ ]);
42
+ hasSubmitted = false;
43
+ }
44
+
6
45
  describe('FormTextComponent', () => {
7
- let component: FormTextComponent;
8
- let fixture: ComponentFixture<FormTextComponent>;
9
- let stylesMap = new Map<string, string>();
10
- let translationErrorLabelMap = new Map<string, string>();
46
+ let hostFixture: ComponentFixture<FormTextHostComponent>;
47
+ let host: FormTextHostComponent;
48
+
11
49
  beforeEach(waitForAsync(() => {
12
50
  TestBed.configureTestingModule({
13
- declarations: [ FormTextComponent ],
14
- providers: [ FormGroupDirective ]
15
- })
16
- .compileComponents();
51
+ declarations: [FormTextHostComponent, FormTextComponent],
52
+ imports: [ReactiveFormsModule],
53
+ }).compileComponents();
17
54
  }));
18
55
 
19
56
  beforeEach(() => {
20
- fixture = TestBed.createComponent(FormTextComponent);
21
- component = fixture.componentInstance;
22
- component.stylesMap = stylesMap.set('themeColor', "#2a6ac1")
23
- .set('foregroundColor', "#ffffff")
24
- component.translationErrorLabelMap = translationErrorLabelMap.set('LABEL_ERROR_FIELD_REQUIRED', "LABEL_ERROR_FIELD_REQUIRED")
25
- fixture.detectChanges();
57
+ hostFixture = TestBed.createComponent(FormTextHostComponent);
58
+ host = hostFixture.componentInstance;
59
+ hostFixture.detectChanges();
60
+ });
61
+
62
+ it('should create with label and stable id from mock-like field', () => {
63
+ expect(hostFixture.nativeElement.querySelector('chat-form-text')).toBeTruthy();
64
+ const input = hostFixture.nativeElement.querySelector(
65
+ 'input#c21-prechat-userFullname',
66
+ ) as HTMLInputElement;
67
+ expect(input.type).toBe('text');
68
+ expect(input.getAttribute('aria-required')).toBe('true');
69
+ });
70
+
71
+ it('should use email input type when control name suggests email', () => {
72
+ host.controlName = 'userEmail';
73
+ host.element = clonePrechatFormJsonMock()[1] as FormArray;
74
+ host.element.text = 'Email';
75
+ hostFixture.detectChanges();
76
+ const input = hostFixture.nativeElement.querySelector(
77
+ 'input#c21-prechat-userEmail',
78
+ ) as HTMLInputElement;
79
+ expect(input.type).toBe('email');
80
+ });
81
+
82
+ it('should show required error region when submitted and empty', () => {
83
+ host.hasSubmitted = true;
84
+ hostFixture.detectChanges();
85
+ const input = hostFixture.nativeElement.querySelector(
86
+ 'input#c21-prechat-userFullname',
87
+ ) as HTMLInputElement;
88
+ expect(input.getAttribute('aria-invalid')).toBe('true');
89
+ expect(input.getAttribute('aria-describedby')).toBe('c21-prechat-userFullname-errors');
90
+ const alert = hostFixture.nativeElement.querySelector(
91
+ '#c21-prechat-userFullname-errors',
92
+ ) as HTMLElement;
93
+ expect(alert.textContent).toContain('Required field');
94
+ });
95
+
96
+ it('onEnterPressed should emit keyboard event', () => {
97
+ const inner = hostFixture.debugElement.query(By.directive(FormTextComponent))
98
+ .componentInstance as FormTextComponent;
99
+ spyOn(inner.onKeyEnterPressed, 'emit');
100
+ const ev = new KeyboardEvent('keydown', { key: 'Enter' });
101
+ inner.onEnterPressed(ev);
102
+ expect(inner.onKeyEnterPressed.emit).toHaveBeenCalledWith(ev);
103
+ });
104
+
105
+ it('ariaInvalid should stay false until form is submitted', () => {
106
+ const inner = hostFixture.debugElement.query(By.directive(FormTextComponent))
107
+ .componentInstance as FormTextComponent;
108
+ expect(inner.ariaInvalid).toBe('false');
109
+ host.hasSubmitted = true;
110
+ hostFixture.detectChanges();
111
+ expect(inner.ariaInvalid).toBe('true');
26
112
  });
27
113
 
28
- it('should create', () => {
29
- expect(component).toBeTruthy();
114
+ it('ngOnChanges should map theme CSS variables onto host', () => {
115
+ const innerDe = hostFixture.debugElement.query(By.directive(FormTextComponent));
116
+ const inner = innerDe.componentInstance as FormTextComponent;
117
+ inner.ngOnChanges({
118
+ stylesMap: {
119
+ currentValue: host.stylesMap,
120
+ previousValue: null,
121
+ firstChange: true,
122
+ isFirstChange: () => true,
123
+ },
124
+ } as any);
125
+ expect(innerDe.nativeElement.style.getPropertyValue('--themeColor')).toBe('#2a6ac1');
30
126
  });
31
127
  });
@@ -1,5 +1,6 @@
1
- import { Component, ElementRef, EventEmitter, Input, OnInit, Output, SimpleChange, ViewChild } from '@angular/core';
1
+ import { Component, ElementRef, EventEmitter, Input, OnInit, OnDestroy, Output, SimpleChange, ViewChild } from '@angular/core';
2
2
  import { FormGroup, FormGroupDirective } from '@angular/forms';
3
+ import { Subscription } from 'rxjs';
3
4
  import { FormArray } from '../../../../../chat21-core/models/formArray';
4
5
 
5
6
  @Component({
@@ -7,7 +8,7 @@ import { FormArray } from '../../../../../chat21-core/models/formArray';
7
8
  templateUrl: './form-text.component.html',
8
9
  styleUrls: ['./form-text.component.scss']
9
10
  })
10
- export class FormTextComponent implements OnInit {
11
+ export class FormTextComponent implements OnInit, OnDestroy {
11
12
 
12
13
  @Input() element: FormArray;
13
14
  @Input() controlName: string;
@@ -19,19 +20,50 @@ export class FormTextComponent implements OnInit {
19
20
  @ViewChild('div_input') input: ElementRef;
20
21
  form: FormGroup<any>;
21
22
  inputType: string = 'text'
23
+ private valueChangesSub?: Subscription;
24
+
25
+ get fieldBaseId(): string {
26
+ const raw = this.element?.name || this.controlName || 'field';
27
+ return 'c21-prechat-' + String(raw).replace(/[^a-zA-Z0-9_-]/g, '_');
28
+ }
29
+
30
+ get errorsId(): string {
31
+ return this.fieldBaseId + '-errors';
32
+ }
33
+
34
+ get ariaDescribedByErrors(): string | null {
35
+ const name = this.element?.name;
36
+ if (!this.hasSubmitted || !this.form?.controls?.[name]?.errors) {
37
+ return null;
38
+ }
39
+ return this.errorsId;
40
+ }
41
+
42
+ get ariaInvalid(): 'true' | 'false' {
43
+ const name = this.element?.name;
44
+ if (!this.hasSubmitted || !this.form?.controls?.[name]) {
45
+ return 'false';
46
+ }
47
+ return this.form.controls[name].invalid ? 'true' : 'false';
48
+ }
49
+
22
50
  constructor(private rootFormGroup: FormGroupDirective,
23
51
  private elementRef: ElementRef) { }
24
52
 
25
53
  ngOnInit() {
26
54
  this.form = this.rootFormGroup.control as FormGroup<any>;
27
55
  if(this.form && this.form.controls && this.form.controls[this.controlName]){
28
- this.form.controls[this.controlName].valueChanges.subscribe((value) => {
56
+ this.valueChangesSub = this.form.controls[this.controlName].valueChanges.subscribe((value) => {
29
57
  this.hasSubmitted= false;
30
58
  this.setFormStyle();
31
59
  })
32
60
  }
33
61
  }
34
62
 
63
+ ngOnDestroy() {
64
+ this.valueChangesSub?.unsubscribe();
65
+ }
66
+
35
67
  ngOnChanges(changes: SimpleChange){
36
68
  if(this.controlName && (this.controlName.toLowerCase().includes('email') || this.controlName.toLowerCase().includes('e-mail')) ){
37
69
  this.inputType = 'email';
@@ -1,25 +1,27 @@
1
1
  <form [formGroup]="form">
2
- <div class="form-group label-floating" id="div_input" #div_input
2
+ <div class="form-group label-floating" [id]="'wrap-' + fieldBaseId" #div_input
3
3
  [ngClass]="{'is-empty': !form?.controls[element.name]?.value}">
4
- <label class="control-label">
4
+ <label class="control-label" [attr.for]="fieldBaseId">
5
5
  {{element?.text}}
6
6
  </label>
7
- <textarea
8
- [formControlName]="element?.name"
7
+ <textarea
8
+ [id]="fieldBaseId"
9
+ [formControlName]="element?.name"
9
10
  [rows]="rows"
10
11
  [tabIndex]="element?.tabIndex"
11
12
  type="text"
12
13
  class="form-control"
14
+ [attr.aria-required]="element?.mandatory ? 'true' : null"
15
+ [attr.aria-invalid]="ariaInvalid"
16
+ [attr.aria-describedby]="ariaDescribedByErrors"
13
17
  (keydown)="onkeydown($event)"
14
- (keydown.enter)="onEnterPressed($event)"
15
- (focus)="onFocus()"
18
+ (keydown.enter)="onEnterPressed($event)"
19
+ (focus)="onFocus()"
16
20
  (focusout)="onFocusOut()">
17
21
  </textarea>
18
22
  </div>
19
- <div *ngIf="hasSubmitted && form?.controls[element.name].errors && form?.controls[element.name].hasError('required')" class="text-danger">
20
- {{translationErrorLabelMap.get('LABEL_ERROR_FIELD_REQUIRED')}}
21
- </div>
22
- <div *ngIf="hasSubmitted && form?.controls[element.name].errors && form?.controls[element.name].hasError('pattern') && element?.errorLabel" class="text-danger">
23
- {{element.errorLabel}}
23
+ <div [id]="errorsId" *ngIf="hasSubmitted && form?.controls[element.name]?.errors" class="text-danger" role="alert">
24
+ <span *ngIf="form?.controls[element.name].hasError('required')">{{translationErrorLabelMap.get('LABEL_ERROR_FIELD_REQUIRED')}}</span>
25
+ <span *ngIf="form?.controls[element.name].hasError('pattern') && element?.errorLabel">{{element.errorLabel}}</span>
24
26
  </div>
25
27
  </form>
@@ -42,7 +42,7 @@
42
42
  }
43
43
 
44
44
  /* Remove input border colour */
45
- textarea:focus,
45
+ textarea:focus:not(:focus-visible),
46
46
  textarea:active,
47
47
  textarea:hover,
48
48
  textarea:visited {
@@ -52,9 +52,6 @@
52
52
  background-position: center bottom,center calc(100% - 1px);
53
53
  background-color: rgba(0,0,0,0);
54
54
  transition: background 0s ease-out;
55
- // box-shadow: none;
56
- // background-color: #ffffff;
57
- // outline: none;
58
55
  }
59
56
 
60
57
  /* Remove input background colour for Chrome autocomplete */
@@ -182,11 +179,15 @@ textarea {
182
179
  background-repeat: no-repeat;
183
180
  background-position: center bottom,center calc(100% - 1px);
184
181
  background-size: 100% 2px, 100% 1px;
185
- // box-shadow: none;
186
182
  transition-duration: 0.3s;
187
183
  width: 100%;
188
184
  }
189
185
 
186
+ .form-group.is-focused .form-control:focus-visible {
187
+ outline: 2px solid var(--themeColor, #1a73e8) !important;
188
+ outline-offset: 2px;
189
+ }
190
+
190
191
  .form-group.is-focused.form-info .form-control {
191
192
  background-image: linear-gradient(#00bcd4, #00bcd4), linear-gradient(#D2D2D2, #D2D2D2);
192
193
  }