🐛 répare la submission lors du doubleclick sur les réponse

pull/1114/head
Johan Girod 2020-09-07 15:46:36 +02:00
parent 804f2d8fb0
commit 46a510c443
1 changed files with 14 additions and 4 deletions

View File

@ -36,6 +36,14 @@ export default function Question({
},
[setCurrentSelection]
)
const handleSubmit = useCallback(
(src, value) => {
setCurrentSelection(value)
onChange(value)
onSubmit(src)
},
[onSubmit, onChange, setCurrentSelection]
)
useEffect(() => {
if (currentSelection != null) {
@ -65,7 +73,7 @@ export default function Question({
value,
label,
currentSelection,
onSubmit,
onSubmit: handleSubmit,
name: questionDottedName,
onChange: handleChange
}}
@ -88,7 +96,7 @@ export default function Question({
label: 'Aucun',
currentSelection,
name: questionDottedName,
onSubmit,
onSubmit: handleSubmit,
dottedName: null,
onChange: handleChange
}}
@ -113,7 +121,7 @@ export default function Question({
currentSelection,
name: questionDottedName,
icons,
onSubmit,
onSubmit: handleSubmit,
description,
onChange: handleChange
}}
@ -171,7 +179,9 @@ function RadioLabelContent({
return (
<label
key={value}
onDoubleClick={() => onSubmit('dblClick')}
onDoubleClick={() => {
onSubmit('dblClick', value)
}}
style={labelStyle}
className={classnames('userAnswerButton ui__ button', {
selected