File tree Expand file tree Collapse file tree
adhocracy4/polls/static/PollDashboard Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import React from 'react'
22import django from 'django'
33import FormFieldError from '../../../static/FormFieldError'
44
5- export const EditPollChoice = ( props ) => {
5+ export const EditPollChoice = React . forwardRef ( ( props , ref ) => {
66 return (
7- < div className = "form-group" >
7+ < div className = "form-group" ref = { ref } >
88 < div htmlFor = { 'id_choices-' + props . id + '-name' } >
99 { django . pgettext ( 'noun' , 'Answer' ) } { props . index }
1010 { props . choiceId &&
@@ -43,4 +43,6 @@ export const EditPollChoice = (props) => {
4343 />
4444 </ div >
4545 )
46- }
46+ } )
47+
48+ EditPollChoice . displayName = 'EditPollChoice'
Original file line number Diff line number Diff line change @@ -242,6 +242,7 @@ export const EditPollManagement = (props) => {
242242 ? (
243243 < EditPollOpenQuestion
244244 id = { key }
245+ key = { key }
245246 question = { question }
246247 onLabelChange = { ( label ) => handleQuestionLabel ( index , label ) }
247248 onHelptextChange = { ( helptext ) => handleQuestionHelpText ( index , helptext ) }
@@ -254,6 +255,7 @@ export const EditPollManagement = (props) => {
254255 : (
255256 < EditPollQuestion
256257 id = { key }
258+ key = { key }
257259 question = { question }
258260 onLabelChange = { ( label ) => handleQuestionLabel ( index , label ) }
259261 onHelptextChange = { ( helptext ) => handleQuestionHelpText ( index , helptext ) }
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import django from 'django'
33import FormFieldError from '../../../static/FormFieldError'
44import { HelptextForm } from './HelptextForm'
55
6- export const EditPollOpenQuestion = ( props ) => {
6+ export const EditPollOpenQuestion = React . forwardRef ( ( props , ref ) => {
77 const [ hasHelptext , setHasHelptext ] = useState ( props . question . help_text )
88
99 return (
10- < section className = "editpoll__question-container" >
10+ < section ref = { ref } className = "editpoll__question-container" >
1111 < div className = "editpoll__question" >
1212 < div className = "editpoll__question--border" >
1313 < div className = "form-group" >
@@ -80,4 +80,6 @@ export const EditPollOpenQuestion = (props) => {
8080 </ div >
8181 </ section >
8282 )
83- }
83+ } )
84+
85+ EditPollOpenQuestion . displayName = 'EditPollOpenQuestion'
Original file line number Diff line number Diff line change @@ -6,11 +6,11 @@ import { HelptextForm } from './HelptextForm'
66
77const FlipMove = require ( 'react-flip-move' ) . default
88
9- export const EditPollQuestion = ( props ) => {
9+ export const EditPollQuestion = React . forwardRef ( ( props , ref ) => {
1010 const [ hasHelptext , setHasHelptext ] = useState ( props . question . help_text )
1111 const hasOtherOption = props . question . choices . find ( c => c . is_other_choice )
1212 return (
13- < section className = "editpoll__question-container" >
13+ < section ref = { ref } className = "editpoll__question-container" >
1414 < div className = "editpoll__question" >
1515 < div className = "form-group editpoll__question--border" >
1616 < label
@@ -162,4 +162,6 @@ export const EditPollQuestion = (props) => {
162162 </ div >
163163 </ section >
164164 )
165- }
165+ } )
166+
167+ EditPollQuestion . displayName = 'EditPollQuestion'
You can’t perform that action at this time.
0 commit comments