Submission Form Allows Deletion of All Repeating Item Entries

Open Beginner friendly
#6,511 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
angular, typescript
Domain
frontend

Research direction

The delete button is wired to removeItem() in src/app/shared/form/form.component.ts, which the report links at version 8.4 and 10.1 for comparison. Start there, then reproduce in a submission form repeatable field: add an entry, delete the first, and check the remaining one. Done means a lone remaining entry has no delete button and the last entry cannot be removed, with the add-more button still visible.

Written by the indexing model from the issue text.

Description

bug needs triage

Describe the bug

When clicking the "Add More" button in a submission form, and then deleting the first item in the array of two, the trash / deletion button remains next to the single item, allowing deletion of all items in the array, and removing the add more button, forcing the user to reload the page if they want to add values to that submission form input. Running DSpace 8.4, appears on both Chrome and Safari.

After investigation, this bug does not appear in the newest stable release of DSpace (10.1), and I believe this is because the removeItem() function that the delete button calls was changed in version 10.x – see the difference between version 8.4 and version 10.1 here, where in the latter, the function checks the form array length and only removes the input if it is greater than 1.

I haven't tested it, but I therefore believe this issue affects all DSpace versions 8.x and 9.x, since this code only exists in 10.x.

To Reproduce

  1. Begin the submission process
  2. Type something into a repeatable form element
  3. Click 'Add More'
  4. Delete the first element where a value exists
  5. The empty element should have a delete button that allows removal of all inputs

Expected behavior

Single elements in repeatable input arrays should not have the delete button appear.

Related work

TBD

Dominant language
TypeScript
Stars
180
Forks
577
Avg merge
2d 18h
Merged PRs (30d)
115

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DSpace/dspace-angular

All issues in DSpace/dspace-angular

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.