Repository navigation
fix(widget): validate on submit and focus first invalid field - #622
Conversation
|
Note on CI As noted in issue #614 and |
anurag629
left a comment
There was a problem hiding this comment.
Thanks @bhushan4work. Start Chat stays enabled, so Tab reaches it and Enter in a field submits the form. A failed submit shows every error and moves focus to the first invalid field, and the * is hidden from screen readers next to aria-required. The unit tests check where focus goes, and S5 presses Start Chat on the empty form and runs axe.
I added the new S5 screenshots from the Update screenshots workflow. Start Chat is at full color now, and they also pick up the header's "..." menu from #505, which the old images were made before. I updated your branch with dev too. All checks pass, including e2e.
|
Merged, thanks @bhushan4work. |
What does this change?
*marker from screen readers usingaria-hidden="true".updateSubmitState()and.cc-prechat-submit:disabledCSS rule.website/src/content/docs/widget/pre-chat-form.mdx.prechat-form.test.tsand E2E state tests instates.spec.ts.Closes #614
How I tested this
Ran the verification checks locally:
pnpm vitest run --project @chatcops/widget prechat-form(22/22 passed)pnpm test:coverage(142 test files passed, coverage thresholds met)pnpm lint(passed without errors)pnpm size(pre-chat form chunk 1.78 kB, within 2 kB limit)pnpm e2e(all 97 functional and state tests passed, 21 visual tests skipped locally on macOS)CI run verification:
s5-prechat-light.png,s5-prechat-dark.png,s5-prechat-rtl.png), which is the expected visual baseline change since the Start Chat button is now enabled (previously rendered disabled at 50% opacity). Per issue Pre-chat form: let visitors press Start Chat and see what's missing #614 and CONTRIBUTING.md, this baseline is updated by maintainers via the "Update screenshots" workflow.AI assistance
None
Checklist
devpnpm -r build,pnpm testandpnpm -r typecheckpass locallypnpm changeset) if this changescore,widgetorserverpnpm apirun andapi/committed if an exported type or option changed