Commit graph

44 commits

Author SHA1 Message Date
Dan Stillman
f245f5c2b2 fx153: Set XUL checked/disabled as boolean attributes
Bug 2008041 made them html-style boolean attributes, so presence alone
means true and setAttribute('disabled', false) now disables the element.
Switch the sites that can be passed a falsy value to toggleAttribute(),
read them with hasAttribute(), and drop a disabled="false" from markup.
Sites that only ever pass true are left alone.
2026-08-03 11:48:40 -04:00
Dan Stillman
bcd8ad20ec fx153: Use command events for checkbox changes
Bug 2009806 moved XUL checkbox click handling into C++ and dropped the
CheckboxStateChange event, so listen for command instead. The event now
only fires on user interaction, so the tests have to click the checkboxes
rather than assign to .checked.
2026-08-03 11:48:40 -04:00
Adomas Venčkauskas
9c03a93e00
Fix tree multi-selection collapse/expand behaviour (#5983)
Closes #5974.

Additional fixes for broken item tree behaviour when multiple items are
selected, and changing focus with ctrl/cmd-arrow keys.

Aligned Collection Tree/Virtualized Tree collapse/expand behaviour when
multiple containers are selected, one of them is focused, and arrow key
left-right is pressed, to the behaviour in Item Tree - now all of them
are collapsed/expanded.

---------

Co-authored-by: Dan Stillman <dstillman@zotero.org>
2026-07-31 13:25:01 -04:00
Dan Stillman
5d1a2cba32 Remove the singular collection tree selection getters
Multi-collection selection left .collectionTreeRow and similar in place
to reduce breakage, but that would just leave plugins and other callers
potentially broken when multiple rows were selected. All singular
getters now throw and say what to use instead. getSelectedLibraryIDs()
was added to replace getSelectedLibraryID().
2026-07-29 13:12:47 -04:00
Dan Stillman
40974e493d Fix Cmd/Ctrl-A not selecting all libraries when feeds are visible
Selecting all libraries pulled in feed rows, which belong to a different
visibility group and so can't be shown together, collapsing the
selection back to a single row. Constrain the all-libraries scope to the
current selection's visibility group. Also preventDefault() the shortcut
so it no longer falls through to the cmd_selectAll key command, which
threw NS_ERROR_FAILURE.

https://forums.zotero.org/discussion/132843/beta-cannot-select-all-libraries
2026-07-21 14:04:00 -04:00
Dan Stillman
da88c63231 Make the collection tree filter accent-insensitive
Addresses #1300
2026-07-15 15:36:40 -04:00
Tom Najdek
e71bd89e0d Add support for undo/redo (#5823)
---------

Co-authored-by: Dan Stillman <dstillman@zotero.org>
2026-06-19 14:12:54 -04:00
Dan Stillman
08d875c7f7 Handle multiple-library item selections dropped on a collection or library
Route each item by its own library -- items already in the target
library are added directly (or skipped, for a library root), while
items from other libraries are copied in -- instead of attempting an
invalid cross-library insert. Disallow a move of such a selection
rather than silently copying.

Fixes #5961
2026-06-18 16:13:16 -04:00
Dan Stillman
15c2c95470 Support multiple-collection selection (#5954)
Allow selecting multiple collections, saved searches, or library roots in the
collection tree -- within a library or across libraries -- and show the union
of their items. The selection is threaded through the pane as an array
(getCollectionTreeRows(), changeCollectionTreeRows(), etc.); the item pane, tag
selector, reports, and export operate on all selected rows.

Adding items (new items and notes, drag-and-drop, the attachment dialog,
import, Add by Identifier) targets every selected collection. Only rows that can
share an items view may be combined: collections, saved searches, and library
roots mix freely, and multiple Recently Read rows can be combined across
libraries, but other special views (Trash, Duplicates, etc.) and rows from
different visibility groups can't be shown together, so a selection mixing them
keeps only the focused row. In-window advanced search runs across all selected
collections.

Advanced search value autocomplete is now scoped to the searched library, fixing
a long-standing TODO where suggestions were drawn from all libraries regardless
of the search scope; for a cross-library selection it spans the selected
libraries.

For a cross-library selection, the tag selector shows the union of tags
(colored tags only when a single library is in scope, since colors are
per-library), and deleting a tag spans all selected libraries while
rename/color/split are disabled. If advanced search is open, the
collection and saved-search conditions are omitted, since each is scoped
to a single library.
2026-06-18 14:05:55 -04:00
Adomas Venčkauskas
5ca1fbb167 Item tree refactor megacommit
Split ItemTree megaclass into:
- ItemTree - concerned with drawing the virtualized table container and
  column interaction
- ItemTreeRowProvider - provides rows and issues notifications for
  render updates
- ItemTreeRow and subclasses - contains row-specific data and rendering
  logic
- CollectionViewItemTree and its accompanying classes - a version of
  ItemTree that renders items attached to a given Collection or
  CollectionView (CollectionTreeRow).

Various improvements in logic and rendering, separation of concerns.
2026-04-27 14:44:39 -04:00
Dan Stillman
c2c66795d2 Add some extra asserts to debug test flakiness in CI 2026-04-17 10:47:04 -04:00
Dan Stillman
d5ee350081 Disable snapshot saving in feed item translation itest
To try to fix intermittent CI errors
2026-04-03 09:58:47 -04:00
Dan Stillman
1fad46f983 Disable OA PDF lookups in feed item translation test
Avoid external network requests during test that may have been a source
of intermittent CI failures.
2026-03-19 11:04:22 -04:00
Abe Jellinek
34039991f8
Track attachment last-read time, add Recently Read virtual collection (#2854)
Track when attachments are last opened or read, storing a `lastRead` Unix timestamp on the attachment. For user library items, `lastRead` syncs as an attachment property in item JSON. For group library items, it syncs via a per-user synced setting (like `lastPageIndex`).

- Add `lastRead` column to `itemAttachments`
- Add `AttachmentReadObserver` to update `lastRead` on file open and page change (throttled to 5 min for page changes)
- Add "Recently Read" virtual collection (items read in last 14 days, sorted by `lastRead` descending)
- Add `lastRead` search condition with date operators
- Add `lastRead` item tree column with new `dependsOnChildren` property for parent item aggregation
- Add `getItemLastRead()` to return max `lastRead` across child attachments

Also:

- Generalize collection tree SCSS to support universal (context-fill) icons alongside themed icons

---------

Co-authored-by: Dan Stillman <dstillman@zotero.org>
2026-03-17 13:52:00 -04:00
Tom Najdek
518e7d22a0 Fix a flaky test on CI 2026-03-11 14:35:39 -04:00
Dan Stillman
2b262c5442 CI: Fix disabling of certain tests
Wrong property name
2026-01-27 13:34:25 -05:00
Dan Stillman
7d79ec01a5 CI: Disable "should add an item to My Publications" test due to errors
https://github.com/zotero/zotero/issues/5749
2026-01-27 12:14:01 -05:00
abaevbog
ae9330b513
Fix no onActivate handling on double click of collectionTree rows (#5656)
After 015769a removed pointer-events: none from table cells,
clicking on the collectionTree would always trigger
a focusout event, ZoteroPane.handleBlur would call
collectionTree.setHighlightedRows, which would always
redraw the collectionTree. This complete tree redraw on
every click made it impossible to register double-clicks.

With this change, setHighlightedRows won't have
any effect if called with the same rows to highlight
as before (including no rows).
Without constant tree redraws, double-clicks fire as expected.

Fixes: #5655
2025-12-15 23:11:53 -05:00
Abe Jellinek
67d2e1cead fx140: Asyncify/ESMify tests
They seem to be succeeding when run individually, but failing when
run as a whole. Not sure why yet.
2025-07-30 22:30:53 -04:00
abaevbog
e625c0009e
Fixes to annotation row behavior in trash (#5266)
- right-click on annotation rows in trash will display
  "Delete Permanently" option, instead of an empty menu
- in trash and other non-editable collection rows, disable
  "Add Note from Annotations" button in itemPane header
- remove ability to add tags to annotations and other
  items by dragging them into tag selector from trash
- remove ability to add items to collections by
  dragging them into collection tree from trash
- fix attachment row being removed from trash if
  its child annotation row is erased

Also:
- fix contextPane in reader tab being editable for item in trash
- fix title being editable in attachmentBox for item in trash

Fixes: #5261
2025-05-09 02:05:53 -04:00
Adomas Venčkauskas
67b5a0bb19 Use the bundled mozilla httpd (#5148) 2025-04-22 09:47:58 -04:00
abaevbog
506f3b14e3
Allow dragging items, collections, and searches into trash (#5033)
Fixes: #1943
2025-02-13 02:58:25 -05:00
Dan Stillman
7a467b8bfa Fix selectItems() not selecting non-top-level item in trash
https://forums.zotero.org/discussion/comment/484380/#Comment_484380

Adds `Zotero.Item#isInTrash()` that returns true if the item or any of
its ancestors is in the trash (i.e., `.deleted == true`)
2025-01-27 04:02:10 -05:00
Dan Stillman
26bcc49174 Use arrays for DataTransfer#types in tree tests
After the fix for #4893

(And fix a bug that was revealed in the process)
2024-12-14 01:16:03 -05:00
Dan Stillman
ca5ea08e2b Fix failing test from 173f4c491e 2024-06-24 03:01:57 -04:00
Dan Stillman
621435be68 Tests: Rework collection/search-in-trash tests
- Update for auto-`skipSelect` on collections and searches
- Remove interdependencies that prevented independent runs
- Remove unnecessary manual object names
- Remove unnecessary delay
- Switch to new convenience selection functions
- Switch to customary object naming
2024-06-24 02:45:20 -04:00
Dan Stillman
173f4c491e Tests: Don't auto-select collections and searches after creation
This changes `createDataObject()` to pass `skipSelect: true` for objects
other than items. If a test is creating a bunch of collections, there's
no reason for each one to be selected and for an items list to start to
load. If a test does need a new collection or search to be selected, it
can call the new convenience function `await select(win, obj)`, which
will select the passed object in the collection tree and wait for its
items list to load. I'm hoping this reduces random test failures due to
items list churn.
2024-06-24 02:45:20 -04:00
Bogdan Abaev
a532cfb475 trash functionality for collections and searches (#3307)
When a collection or a saved search is deleted, it appears in
trash among other trashed items. From there, it can be restored
or permanently deleted.

Items of trashed collections are not affected my the trashing/permanent
deletion of a collection and need to be deleted separately like before.

Subcollections of a trashed collection do not appear in the trash and
are restored or permanently deleted with the top-most trashed parent.
2024-06-17 23:14:21 -04:00
abaevbog
91876e4185 updated collection filter collapsed rows test
It should ensure that all rows that were collapsed before filtering
are collapsed once the filter is cleared.
2024-01-24 23:32:20 -05:00
Bogdan Abaev
f8a6b82c63 collection search 2024-01-24 04:03:12 -05:00
abaevbog
200e1d7564 toolbar and keyboard navigation updates
1. Toolbarbuttons changes:
	1. “New Library” moved from toolbar to File menu
	2. “New note” on click makes a standalone note
	3. “New attachment” on click adds stored copy of a file
	4. Menuitems from old note or attachment menus moved to the File menu
	5. “Advanced search” removed. Sync and Locate buttons moved to the top-right corner (Locate - temporarily)
	6. Added “Opened tabs” toolbarbutton
	7. Updated tooltips
2. Added a toolbarbutton that reveals collection search field on click. Search field is hidden on blur if empty. Keyboard accessibility via tab/shift-tab.
3. Tab based navigation restructuring. For each component, create a mapping of target ids with desired focus destination for each relevant keyboard event and use that to determine where to move focus next. Fixed bugs with focus wraparound not working when a note or attachment is opened in contextMenu.
4. Make quick-search dropmarker a sibling of the textfield. QuickSearchTextbox does not extend search-textfield anymore. It serves as a container to house dropmarker and textfield as siblings. This is needed to remove focus ring from quick search textbook when focus moves onto the dropmarker.
5. Separate toolbars for item and collection trees. Removed unused code manually setting the width of toolbar section
6. Focusable tabs + keyboard navigation:
	1. Shift-tab from opened tabs menu moves focus to the currently opened tab
	2. When a tab has focus, use left/right arrows to select tabs, or CMD/Ctrl + arrows to move focus between tabs
	3. Enter or Space on a focused tab will select it if needed and move focus to the contentPane of the reader of this tab
	4. Shift-tab from tabs wraps focus around to itemTree or itemPane
7. “New collection” creates collection contextually within currently selected library or collection.
8. Items pane minimum width increase to avoid quicksearch from being squashed
9. Do not move focus to title field of itemBox after itemTypeMenu is closed with ESC.
10. Display all itemTypes without "Show more" submenu in "New Item" meunu. Removed "Store Copy of File" and "Link to File" from "New Item" menu.
2024-01-24 03:42:42 -05:00
Dan Stillman
9dd182e9ca Collection tree selection fixes
Fixes various logic around what gets selected when collections and
searches are moved to or restored from the trash (which has never been
exposed) or when they're erased
2023-08-11 04:16:42 -04:00
Dan Stillman
02198b12fe Fix dragging to My Publications
Also:

  - Don't show file options if only linked files
  - Don't set Rights field to "All Rights Reserved" if no files
2023-07-29 02:22:20 -04:00
Abe Jellinek
a47a17852e Fix feed item drag test's after() callback 2023-04-17 16:28:10 -04:00
Adomas Venčkauskas
096a3c5f2f Add a test for feed update scroll issues. See fd744fb52 2023-04-17 12:30:31 +03:00
Dan Stillman
2397940292 Use httpd.js instead of resource:// URL for feed item drag test
Since HiddenBrowser doesn't work on resource:// URLs (at least without
modifications, and it wouldn't be representative)
2023-04-15 05:07:47 -04:00
Abe Jellinek
b6591dba5a
Make Feeds row into a selectable global view of feed items (#2800) 2022-11-14 16:55:28 -05:00
Dan Stillman
344a10421a Fix copying of standalone attachments between libraries
Regression in f684984b07 (maybe a race condition)
2022-08-13 02:04:07 -04:00
Dan Stillman
03242e8984 fx-compat: DB.executeTransaction() no longer takes generator functions 2022-05-12 02:38:59 -04:00
Dan Stillman
b54b7edf9b Don't set author name of current user when copying annotation from group
Fixes #2358
2022-02-19 13:47:28 -05:00
Dan Stillman
54eb13ce9e Fix annotation-copying tests after bacc5b4428 2022-02-09 00:07:58 -05:00
Dan Stillman
bacc5b4428 Preserve explicit annotation author name when copying from group 2022-02-08 23:57:49 -05:00
Dan Stillman
f684984b07 Copy annotations across libraries
Based on option in prefs

When copying an annotation group the
2022-02-08 06:38:32 -05:00
Adomas Venčkauskas
cbbff600a6 XUL -> JS tree megacommit
- Just a single huge commit. This has been developed over too long a
time, required many tiny changes across too many files and has seen too
many iterations to be separated into separate commits.
The original branch with all the messy commits will be kept around for
posterity
bb220ad0f2...adomasven:feature/react-item-tree
- Replaces XUL <tree> element across the whole zotero client codebase
with a custom supermegafast virtualized-table inspired by
react-virtualized yet mimicking old XUL treeview API. The
virtualized-table sits on top on a raw-to-the-metal,
interpreted-at-runtime JS based windowing solution inspired by
react-window. React-based solutions could not be used because they were
slow and Zotero UI needs to be responsive and be able to
display thousands of rows in a treeview without any slowdowns.
- Attempts were made at making this screen-reader friendly, but yet to
be tested with something like JAWS
- RTL-friendly
- Styling and behaviour across all platforms was copied as closely as
possible to the original XUL tree
- Instead of row-based scroll snapping this has smooth-scrolling. If
you're using arrow keys to browse through the tree then it effectively
snap-scrolls. Current CSS snap scroll attributes do not seem to work in
the way we would require even on up-to-date browsers, yet alone the ESR
version of FX that Zotero is on. JS solutions are either terrible for
performance or produce inexcusable jitter.
- When dragging-and-dropping items the initial drag freezes the UI for
a fairly jarring amount of time. Does not seem to be fixable due to
the synchronous code that needs to be run in the dragstart handler.
Used to be possible to run that code async with the XUL tree.
- Item tree column picker no longer has a dedicated button. Just
right-click the columns. The column preferences (width, order, etc) are
no longer handled by XUL, which required a custom serialization and
storage solution that throws warnings in the developer console due to
the amount of data being stored. Might cause temporary freezing on HDDs
upon column resize/reorder/visibility toggling.
- Context menu handling code basically unchanged, but any UI changes
that plugins may have wanted to do (including adding new columns) will
have to be redone by them. No serious thought has gone into how plugin
developers would achieve that yet.
- Opens up the possibility for awesome alternative ways to render the
tree items, including things like multiple-row view for the item tree,
which has been requested for a long while especially by users switching
from other referencing software
2021-08-21 06:58:12 -04:00
Renamed from test/tests/collectionTreeViewTest.js (Browse further)