Maintain focus during removal of supervisor field#689
Merged
Conversation
849e261 to
453df18
Compare
** Why are these changes being introduced: * When the user removes a thesis supervisor field, the focus is left undefined. This has been flagged during an accessibility review, with a preference stated that focus be set explicitly. * Separately, we have identified a bug in the current edit form where the "remove this supervisor" link is not being correctly hidden. These two issues share a need to accurately count how many fields are visible, because fields are not always removed - but hidden. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/ETD-272 ** How does this address that need: * This defines a new function within student_thesis_form.js, to set focus on the first visible supervisor field. This function is called during the cocoon:after-remove hook. * The separate bug in the edit form shares a common concern with this focus work, which is to identify how many fields are visible. Our previous work here just counted "a.remove" links, which turns out to be inadequate because an edit form does not remove existing fields - just hides them. * Both routines now rely on a shared function that counts how many visible fields exist. ** Document any side effects to this change: Our use of javascript on the student-facing thesis forms is now more complex.
453df18 to
5be15bf
Compare
JPrevost
approved these changes
Apr 21, 2021
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the issue where focus is left undefined when a supervisor field is removed.
It also fixes a separate-but-related bug where the "remove this supervisor" link is not appropriately removed on the edit form in some conditions.
Note: I'm not sure how to use ANDI or Wave when changes like this are made - but I have tested this code under keyboard navigation and using visual cues under my locally-installed browsers (Firefox, Chrome, and Safari).
Developer
our guide and
all issues introduced by these changes have been resolved or opened as new
issues (link to those issues in the Pull Request details above)
Code Reviewer
(not just this pull request message)
Requires database migrations?
NO
Includes new or updated dependencies?
NO