-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Annotation deletion popup (bug 1899731) #18900
base: master
Are you sure you want to change the base?
Conversation
ebf8d04
to
ae79bee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need tests in the various editors, in https://github.com/mozilla/pdf.js/tree/master/test/integration, or maybe its own new test file that tests that the toast is properly shown in the various cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this perhaps related to https://bugzilla.mozilla.org/show_bug.cgi?id=1899731, since there seems to be no mention of that bug here?
Please note that we'll need a "full" design specification before implementing this, and given its current state the code will also require a fair amount of work here (as far as I can tell).
I added a link to the Figma specs in the bug. It should be accessible to all of you (let me know if you don't have access, and I'll get you added). |
@calixteman @Snuffleupagus Please wait to review until when this PR is marked as ready -- I am giving some feedback to @ryzokuken to make sure that it matches correctly what is defined in the figma doc :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving just a few high-level comments regarding things/patterns that should be improved.
This is a temporary commit on this branch that aims to address some of the review comments from the PR at mozilla#18900.
First off, thanks everyone for all the comments it's nice to have a stronger sense of direction as to where I need to take this patch. I addressed some of the comments y'all made and marked the appropriate suggestions as "resolved" although please feel free to re-raise anything. To respond to the questions:
Yes it is! Thanks @marco-c for the clarification and sharing the spec. Regarding the code, I hope the bigger pain points have either already been addressed or I'd be hacking on them shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on looking at the code, I believe that there's various cases where the notification won't be closed immediately as I believe is intended when:
- Restoring the editor with Ctrl+Z (i.e. using the keyboard).
- Toggling editing-mode off.
- The entire editorLayer is being destroyed (i.e. when closing the current PDF document).
Apologies, I misunderstood your comment at first. Applied the fix that you'd ultimately suggested. I've marked a number of your comments as resolved, please take a look and let me know if I missed something from my latest commit while I work on addressing the remaining issues. Thanks again for your patience. |
@Snuffleupagus thanks for the last slew of suggestions especially, it taught me a lot about the code and fixed the l10n bug. The code should ideally look much more manageable now. While I make more improvements and add tests, please let me know if you have any further comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing that I think should be supported is closing the undo-bar with the Esc key, and the easiest solution would be to (after implementing the comments below) also add the following code just after this existing code:
if (this.editorUndoBar?.isOpen) {
this.editorUndoBar.hide();
handled = true;
}
I added the ESC key dismiss thingie but note that it's not part of the Figma spec which says:
Maybe we should get the ESC key condition added there. |
Note also the other cases mentioned previously in #18900 (review), maybe those should be added to that list as well? |
Absolutely, I'll mention this to the UX folks. |
Good point, I cleaned up the class fields and simplified the constructor a bit. |
a4130d0
to
13d7c53
Compare
@Snuffleupagus could you please take a look again? Thanks |
Sorry, but to save my time I'm going to defer any further reviewing until this is fully done (and "fixup" patches folded into their parent commits) with all previous review comments addressed and everything working correctly. For example, it seems that #18900 (review) is still open given the issue mentioned in #18900 (comment)? |
1b58526
to
2173fd3
Compare
Thanks for the reminder @Snuffleupagus I discussed the open issue with @calixteman, addressed it and squashed all the commits together. |
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/fd03be89830eff2/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/fd03be89830eff2/output.txt Total script time: 1.03 mins Published |
/botio integrationtest |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/67904e4dfc7c7f3/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/7c7833e8646a434/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/7c7833e8646a434/output.txt Total script time: 9.84 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/67904e4dfc7c7f3/output.txt Total script time: 21.51 mins
|
2173fd3
to
51d78ff
Compare
Move .messageBar out of .dialog into its own standalone class in order to reuse as much of it for the upcoming feature for an undo message for annotations.
51d78ff
to
9beddd5
Compare
@Snuffleupagus @nicolo-ribaudo PTAL I fixed both issues, the first commit should now no longer have any lint errors. |
When a user deletes any number of annotations, they are notified of the action by a popup message with an undo button. Besides that, this change reuses the existing messageBar CSS class from the new alt-text dialog as much as possible.
9beddd5
to
14c9371
Compare
Changed the position of the popup from the bottom to the top of the document (right below the toolbar) in order to match the latest feedback from the design systems team. |
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/93ff346a4b7544d/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/93ff346a4b7544d/output.txt Total script time: 0.96 mins Published |
padding-block: 8px; | ||
padding-inline: 16px 8px; | ||
|
||
font-family: sans-serif; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: font: menu
justify-content: center; | ||
align-items: center; | ||
gap: 8px; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: disable the text selection in the toast.
_multiple: "pdfjs-editor-undo-bar-message-multiple", | ||
}); | ||
|
||
constructor({ container, message, undoButton, closeButton }, eventBus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: disable the context menu in the toast (see noContextMenu
in pdfjs-lib
.
On Windows, when the toast appears, NVDA is reading "Toolbar Undo button" which means that the description and the close button are missed: they probably needs to have some aria attributes. |
This PR adds a simple popup/snackbar setup and wires it up for annotation removal, so when a user deletes any number of annotations, they get a message about it alongside an undo button that allows them to quickly undo the deletion.