Skip to content

feat(quantic): Add a character limit to the follow-up question input#7908

Open
mmitiche wants to merge 5 commits into
mainfrom
SFINT-6844
Open

feat(quantic): Add a character limit to the follow-up question input#7908
mmitiche wants to merge 5 commits into
mainfrom
SFINT-6844

Conversation

@mmitiche

@mmitiche mmitiche commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

SFINT-6844

Summary

Adds a 300-character limit to QuanticGeneratedAnswerFollowUpInput component, with a live character counter, an error state, and a localized validation message. Submission is blocked while the question exceeds the limit.

Changes

  • Enforces a [MAX_FOLLOW_UP_QUESTION_LENGTH (300) limit; submission is blocked and the submit button is disabled while over the limit.
  • Adds a live character counter and a validation message inside a new input-footer part.
  • Counts the trimmed value so leading/trailing whitespace doesn't falsely trigger the limit (keeps the counter consistent with the submitted query).
  • Accessibility: textarea gets aria-invalid when over the limit and aria-describedby linking it to the validation message
  • Error styling when input is invalid

Demo

Screen.Recording.2026-06-30.at.10.01.04.AM.mov

@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9dc8103

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@coveo/quantic Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svcsnykcoveo

svcsnykcoveo commented Jun 30, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a 300-character limit UX to QuanticGeneratedAnswerFollowUpInput, including a live counter, an over-limit error state, localized validation messaging, and unit test coverage for the new behaviors.

Changes:

  • Introduces MAX_FOLLOW_UP_QUESTION_LENGTH = 300, tracks a trimmed characterCount, and blocks submission (button + Enter) when over the limit.
  • Adds an input footer that renders a live character counter plus an over-limit validation message wired via ARIA attributes.
  • Adds a new quantic_FollowUpInputTooLong label with FR/ES translations, and extends Jest tests for the validation/counter behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/quanticGeneratedAnswerFollowUpInput.js Implements trimmed character counting, over-limit state, submit prevention, ARIA wiring, and formatted validation message.
packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/quanticGeneratedAnswerFollowUpInput.html Adds aria-invalid/aria-describedby, uses submit-prevented flag, and renders the new footer (message + counter).
packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/quanticGeneratedAnswerFollowUpInput.css Adds an error border style for the invalid container state.
packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/tests/quanticGeneratedAnswerFollowUpInput.test.js Adds mocks and a full validation/counter test suite for the new limit behavior.
packages/quantic/force-app/main/default/labels/CustomLabels.labels-meta.xml Adds the new EN label quantic_FollowUpInputTooLong.
packages/quantic/force-app/main/translations/fr.translation-meta.xml Adds FR translation for quantic_FollowUpInputTooLong.
packages/quantic/force-app/main/translations/es.translation-meta.xml Adds ES translation for quantic_FollowUpInputTooLong.
.changeset/gold-views-talk.md Declares a patch changeset for @coveo/quantic.

Comment on lines 61 to 65
this.refs.askFollowUpInput.value.trim() === ''
) {
return;
}
this.sendSubmitFollowUpEvent();
Comment on lines +146 to +148
get characterCounterText() {
return `${this.characterCount} / ${MAX_FOLLOW_UP_QUESTION_LENGTH}`;
}
Comment on lines +7 to +10
/**
* Maximum number of characters allowed in a follow-up question.
*/
const MAX_FOLLOW_UP_QUESTION_LENGTH = 300;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I would remove the comment its already pretty obvious

@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown
@coveo/atomic

npm i https://pkg.pr.new/@coveo/atomic@7908

@coveo/atomic-hosted-page

npm i https://pkg.pr.new/@coveo/atomic-hosted-page@7908

@coveo/atomic-legacy

npm i https://pkg.pr.new/@coveo/atomic-legacy@7908

@coveo/atomic-react

npm i https://pkg.pr.new/@coveo/atomic-react@7908

@coveo/auth

npm i https://pkg.pr.new/@coveo/auth@7908

@coveo/bueno

npm i https://pkg.pr.new/@coveo/bueno@7908

@coveo/create-atomic

npm i https://pkg.pr.new/@coveo/create-atomic@7908

@coveo/create-atomic-component

npm i https://pkg.pr.new/@coveo/create-atomic-component@7908

@coveo/create-atomic-component-project

npm i https://pkg.pr.new/@coveo/create-atomic-component-project@7908

@coveo/create-atomic-result-component

npm i https://pkg.pr.new/@coveo/create-atomic-result-component@7908

@coveo/create-atomic-rollup-plugin

npm i https://pkg.pr.new/@coveo/create-atomic-rollup-plugin@7908

@coveo/headless

npm i https://pkg.pr.new/@coveo/headless@7908

@coveo/headless-react

npm i https://pkg.pr.new/@coveo/headless-react@7908

@coveo/shopify

npm i https://pkg.pr.new/@coveo/shopify@7908

commit: 9dc8103

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🔗 Scratch Orgs ready to test this PR:

}

get textareaAriaInvalid() {
return this.isOverCharacterLimit ? 'true' : 'false';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here im pretty sure you can just do:

return !!this.isOverCharacterLimit;

aria-invalid resolves true and false to "true" / "false"

@SimonMilord SimonMilord left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants