move select value from option to select

refs LS-3017
flag=none

test plan:
  - tests pass

qa risk: low

Change-Id: Ia52680b0e2b5c277f6078ea19737c7107985abfb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286069
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
This commit is contained in:
Davis Hyer 2022-02-28 16:15:44 -07:00
parent afac4e90a0
commit bbe2edc991
2 changed files with 6 additions and 2 deletions

View File

@ -85,7 +85,6 @@ const ignoredErrors = [
/The prop `renderLabel` is marked as required in `(FileDrop|NumberInput|Select)`/,
/The prop `rootId` is marked as required in `GroupSelectionDrillDown`/,
/Unexpected keys "searchPermissions", "filterRoles", "tabChanged", "setAndOpenAddTray" found in preloadedState argument passed to createStore/,
/Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>/,
/validateDOMNesting\(...\): %s cannot appear as a child of <%s>/,
/WARNING: heuristic fragment matching going on!/,
/Warning: Failed prop type: Expected one of Checkbox in CheckboxGroup but found `View`/,

View File

@ -82,7 +82,7 @@ class TeacherFeedbackForm extends React.Component {
const value = `course_${c.id}_admins`
return (
<option key={value} value={value} selected={window.ENV.context_id == c.id}>
<option key={value} value={value}>
{c.name}
</option>
)
@ -96,6 +96,10 @@ class TeacherFeedbackForm extends React.Component {
}
render() {
const selectedCourse = this.state.courses
.filter(c => !c.access_restricted_by_date)
.find(c => c.id === window.ENV.context_id)
const currentSelectValue = selectedCourse ? `course_${selectedCourse.id}_admins` : null
return (
<form ref={c => (this.form = c)} action="/api/v1/conversations" method="POST">
<fieldset className="ic-Form-group ic-HelpDialog__form-fieldset">
@ -108,6 +112,7 @@ class TeacherFeedbackForm extends React.Component {
required
aria-required="true"
name="recipients[]"
value={currentSelectValue}
>
{this.renderCourseOptions()}
</select>