Skip to content

fix: validate max number of poll votes based on input validity #2701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 14, 2025
5 changes: 3 additions & 2 deletions src/components/Poll/PollCreationDialog/PollCreationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ export const PollCreationDialog = ({ close }: PollCreationDialogProps) => {
id='max_votes_allowed'
onChange={(e) => {
const isValidValue =
!e.target.value ||
e.target.value.match(VALID_MAX_VOTES_VALUE_REGEX);
e.target.validity.valid &&
(!e.target.value ||
e.target.value.match(VALID_MAX_VOTES_VALUE_REGEX));
if (!isValidValue) {
setMultipleAnswerCountError(
t<string>('Type a number from 2 to 10'),
Expand Down