Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement inline editing for "Change Email" and "Change Password" for…
…ms. (#3911) * Implement support for forms which allow editing multiple fields at once This commit introduces a couple of new features to FormController that are needed by the 'Change Email' and 'Change Password' forms: 1. Support for multiple fields being in the editing state at the same time. This is done by making `state.editingFields` a list and introducing `state.focusedField` which is the most recent field within the editing set that a user focused, indicated by a thick border. Currently there are only two cases we need to support for the edit set - forms which edit one field at a time and forms which edit all fields at once. 2. Support for hidden fields which are shown only when the user starts editing the form. These are indicated by a `data-hide-until-active` attribute on the field's container. * Enable inline editing for Change Email and Change Password forms * Add use_inline_editing flag to Change Email and Change Password forms * Mark the 'Confirm password', 'New password' and 'Confirm new password' fields as being hidden until the user starts interacting with the form * Change label for saving changes to 'Save' as per the mock * Hide hidden-by-default fields on load Avoid FOUC for fields which are hidden until the form is being edited by applying the `is-hidden-when-loading` class. Once FormController is initialized, this class will be removed and replaced with the `is-hidden` class. * Adjust labels depending on active/inactive state of Change Password form * Label the field 'Password' rather than 'Current password' when the form is inactive, since this makes more sense when the 'New password' field is not visible * Add a placeholder to password fields when the form is inactive so that the field does not appear empty if the UA has not autofilled the password * Extract field update logic into a separate method Put all the field DOM update logic together in one method * Add additional API documentation to FormController
- Loading branch information
1 parent
12c72fc
commit 554857d
Showing
8 changed files
with
317 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.