Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to Value of dropdown changes automatically on item submission page #2432

Merged
merged 3 commits into from
Sep 5, 2023

Conversation

hugo-escire
Copy link
Contributor

@hugo-escire hugo-escire commented Aug 13, 2023

References

Add references/links to any related issues or PRs. These may include:

Description

On item submission page, the value of first dropdown automatically resets to the first value present in the dropdown on pressing "enter" in any of the textbox. Now this has been fixed.

Instructions for Reviewers

  1. Go to Item submission page
  2. Select book from “type” dropdown. (Select any value other than first value in dropdown)
  3. Click on text box with label as "identifier" and then press enter.

List of changes in this PR:

  • First, I change the event that triggers the OnSelect function, before it was onClick, now it is "keydown.enter". I made this change because the bug was in the click event, when the detect change was made to some other input (as explained in issue 2145), the click event was triggered on the dropdown by setting the first default value. But currently the "mousedown" event is handled, which seamlessly replaces the click event. Added the "keydown.enter" because trying to interact via the keyboard (and since the click event was not there) failed to fire the event.
  • Second, in the test I had to change the click event to "mousedown", since this is now the event that triggers the onSelect function.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@tdonohue tdonohue changed the title Fix to Issue/2145 Fix to Value of dropdown changes automatically on item submission page Aug 16, 2023
@tdonohue tdonohue added bug component: submission 1 APPROVAL pull request only requires a single approval to merge labels Aug 16, 2023
@tdonohue tdonohue added this to the 7.6.1 milestone Aug 16, 2023
@tdonohue tdonohue added the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Aug 16, 2023
@tdonohue tdonohue self-requested a review August 24, 2023 14:39
@alanorth
Copy link
Contributor

alanorth commented Aug 28, 2023

Thanks @hugo-escire. This is a strange bug that must have been tricky to track down! I was able to reproduce it following the simple instructions. The patch works as described.

I don't fully understand the JavaScript code so I will let someone else inspect and approve.

@alanorth alanorth requested review from alanorth and removed request for alanorth August 28, 2023 17:46
@alanorth alanorth self-requested a review September 5, 2023 17:13
@alanorth
Copy link
Contributor

alanorth commented Sep 5, 2023

On second thought, after reading the explanation of the changes and reviewing the code this change seems straightforward. And, as I noted last week, the patch works as advertised, so I will merge this.

@alanorth alanorth merged commit 8137107 into DSpace:main Sep 5, 2023
10 checks passed
@dspace-bot
Copy link
Contributor

Successfully created backport PR for dspace-7_x:

@tdonohue tdonohue removed the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Sep 5, 2023
@tdonohue tdonohue modified the milestones: 7.6.1, 8.0 Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug component: submission
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Value of dropdown changes automatically on item submission page.
4 participants