Fix #5381: disable delete button for last bitstream with tooltip message#5395
Fix #5381: disable delete button for last bitstream with tooltip message#5395guillermo-escire wants to merge 7 commits into
Conversation
|
Hi @guillermo-escire, |
JohnnyMendesC
left a comment
There was a problem hiding this comment.
Hello @guillermo-escire! Thanks for working on this issue. The visual implementation and the file counting logic work perfectly.
During accessibility testing with a screen reader and keyboard navigation, I noticed two things. One is a requested change for this PR, and the other is a global issue (non-blocker here).
1. Tooltip Accessibility (Requested Change)
Because the native title attribute is used on a standard <span>, screen reader and keyboard-only users cannot access the message explaining why the button is disabled (disabled buttons and standard spans don't receive keyboard focus).
Could we update the wrapper to use an accessible tooltip (like DSpace's ngbTooltip) and add tabindex="0" to it? This ensures all users can read the message.
2. Keyboard bypass on disabled buttons (Non-blocker / Global bug)
While testing, I discovered a global bug in the [dsBtnDisabled] directive itself that allows keyboard bypasses via the Space bar, which triggers the backend error:
@lgeggleston, since this is an issue with the [dsBtnDisabled] directive itself and out of scope for this PR, I understand this could be a non-blocker here. I can open a separate issue/PR to fix the directive globally.
(Note: @guillermo-escire, I left a small inline suggestion to add an early return in the .ts file just as an extra layer of component-level security against this, if you agree).
Great job so far! Let me know if you need help with the tooltip adjustment.
There was a problem hiding this comment.
Should we add an early return here as a safeguard?
While testing, I noticed the modal can still be triggered via the Space bar due to a global bug in [dsBtnDisabled]. Adding this early return acts as a great layer of "defense in depth" to ensure this logic is never executed if there's only one file, regardless of UI state.
| public confirmDelete(content) { | |
| if (this.totalFiles === 1) { | |
| return; | |
| } | |
| this.modalService.open(content).result.then( |
3acdd81 to
fb7a299
Compare
|
Hi @guillermo-escire, |
References
Description
Prevents deletion of the last bitstream in the Edit Item form by disabling the delete button when only one file remains and displaying a user-friendly tooltip explaining the restriction.
Instructions for Reviewers
This PR fixes a UX issue where attempting to delete the last bitstream would silently fail due to backend validation, leaving the user without feedback.
List of changes in this PR:
totalFilesinput to the bitstream component to track the number of files.submission.sections.upload.delete.not-allowed) for the tooltip message.How to test:
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.