By extracting Tab into a separate, memoized component, caching handlers
and tweaking how icons and other props are passed, we're able to only
re-render tabs that actually changed, rather than re-rendering the
entire tab bar all the time. This should be especially noticeable when
dragging tabs around but will reduce CPU cycles used in general.
- listen to 'collection' notifier events and re-render
the section if a relevant collection is moved to trash or
modified. That way, a deleted collection will be removed,
a restored collection will be added back, and renaming a
collection will update the name.
- fixed a bug where a restored collection would not
be added into item._collections cache. Fixed false-positive
test for it.
- do not add deleted collections into items. _collections cache in
Zotero.Items._loadCollections. Otherwise, deleted collections will
appear in librariesCollectionsBox after the app is restarted.
Should reduce jank when opening the item context menu and sidenav
Locate menu, especially on Windows (where the flash of blank menuitems
lasted an especially long time for some reason).
Since the header of the collapsible section is not visible,
there is no way to expand the itemBox if it was collapsed
before dulicate items are selected. With this, itembox
is always opened when a new set of duplicate items is selected.
Fixes: #4318
- added dynamic tooltip whose label is set only when it appears.
It allows us to have a visible tooltip without screen readers
announcing it
- fetch the pane name string and pass it as an argument to
fluent to set the appropriate label on expand/collapse buttons
- tooltiptext is set dynamically on expand/collapse buttons to
avoid having screen readers read both the label and the tooltip text
that are almost identical
- always render options and link buttons - just do
not display them if their respective field is empty.
That allows us to easily handle focus after refresh
because otherwise, the node may does not exist.
If we try to restore focus to such hidden component,
simulate a "tab" from it to focus the next possible node.
This fixes the issue of focus being lost on tab after all
content of editable-text is cleared.
- add tabindex=0 to itemType menulist, otherwise it was
not perceived as a candidate to return focus to.
- somewhat special treatment for restoring focus to
creator rows. If the desired node is not found, we'll
try to focus the respective node in the last creator row.
It prevents focus from being lost on tab after clearing
the very last creator.
Fixes: #4241
this._addCreatorRow needs to be properly initialized to
false (as opposed to being undefined) because 'false'
is the value we check against to decide if an empty
row should be added and focused after rendering.
Fixes: #4268
- only have enabled "Permanently delete" and "Restore to library"
options in the context menu for collections and searches in the trash
- display the custom header with buttons to delete or restore
in the itemPane when a collection or search in the trash is selected
Fixes: #4295
a532cfb475 added `isCollection()`, `isSearch()`, and `isItem()` methods
to data objects to handle collections and searches in the trash, with
`isItem()` checking whether `._ObjectType` was `Item`. That left out
feed items (`._ObjectType` == `FeedItem`), and when c384fef867 made
`getSelectedItems()` return only items, it used `isItem()`, so feed
items were excluded, which broke feed-item toggling between read and
unread [1] and possibly some other things.
The simple fix would be to make `isItem` match feed items as well (which
could potentially fix other bugs related to feed items), but there was
actually no need to add new methods (which can get confused with
`CollectionTreeRow` methods) when we can just check the object type with
`obj instanceof Zotero.Item`, which gets the benefit of inheritance and
matches `Zotero.FeedItem` instances as well.
[1] https://forums.zotero.org/discussion/115571/cannot-change-the-status-of-title-in-subscribtion
Fix to breakage after 3f45def that would not open a duplicate
tab but instead create another reader instance in the same tab.
Instead of finding a tab for a specific item, use tabID that
is passed when reader should be loaded in an unloaded tab. That
allows us to know if the tab is being duplicated or not.
Fixes: #4272
Sidenav button pane IDs usually correspond to sections with the same
IDs, but `context-notes` actually corresponds to two sections
(`context-all-notes` and `context-item-notes`). We were preventing
those sections from being pinned, but not the button that reveals them.
Fixes#4283
This adds an explicit function on ZoteroPane and the item tree for
getting objects -- including collections and searches in the trash --
and limits `getSelectedItems()` to returning actual items from the
selection. We shim various item properties on the collections and
searches in the trash, but code that's getting the selection should be
explicit about what it wants. Outside of the trash, they're equivalent,
except `getSelectedObjects()` does have an `asIDs` mode.
This switches to using getSelectedObjects() in various places and fixes
collections in the trash appearing as belonging to My Publications when
using the collections-containing-an-item highlight [1].
This also adds support for highlighting the parent collections of
collections in the trash.
[1] https://forums.zotero.org/discussion/115449/zotero-7-beta-deleted-collection-appears-as-belonging-to-my-publications
- Remove unsaved creator row on blur or escape
- Rename "unsavedRow" for "position" as we want to be able to find
the relative position of creators after the next refresh not only
for unsaved rows. In many cases "unsavedRow" as returned by getCreatorFields
is the actual index of the creator row.
- Calculate and use "position" in getCreatorFields for all creator rows, not
only unsaved one, when a new row is being added.
This fixed a bug where wrong row gets focused if an unsaved creator row is
added, some text is typed and then another creator row below this unsaved row is clicked.
- fixed a bug where autocomplete options would not be updated after creator mode
is switched for the default empty row (if there are no creators)
- simplified paste handler of creators to use modifyCreator that
also shifts creators if a creator is unsaved. Fixed bug brought up in
https://github.com/zotero/zotero/pull/4165#issue-2313280474 where
pasting creators does not always focus the last added creator.
- Fixed another bug brought up in https://github.com/zotero/zotero/pull/4165#issue-2313280474
where shift-enter from creator before "_ more creators" label
will add a new row in the end instead of focusing the next creator.
- Fixed bug where adding a row right before "_ more creators" label
and blurring it will remove all creators after it. Now, clicking +
on a creator right before the "_ more creators" label will display
all creators and add a row after it.
- Fixed a bug where if "_ more creators" is present, editing
a creator name and pressing shift-enter would loose focus
instead of adding and focusing a new row in the end.
- Fixed a bug where focus got lost from some buttons
Fixes#4143Fixes#4241
- linked color scheme radio buttons to their label. Using
aria-describedby on individual radio buttons instead of
linking color scheme label to radiogroup because voiceover
does not announce the label in that case.
- linked item pane header dropdown to its label
- linked markdown and richtext note format checkboxes to their labels.
- added aria description to linked attachments base directory
so the input and "choose" button
- linked virtualized tables to their labels
Data directory location setting needs some more labeling as well
but it's mechanics should be generally reworked per vpat 50.
- if an unloaded tab is being opened, do not close the
tab and have reader re-open a fresh tab. Instead, keep the
tab as is, have reader use the tab as a container and
just change the tab's type. It should fix a glitch on
windows when if you click on a tab during initial loading,
it will disappear until reader re-adds it. A few tweaks
to allow unloaded tabs be generally "selectable".
Fixes: #4149
- during startup loading, select the yet-unloaded tab right
away. That way, a tab is almost immediately selected,
instead of being stuck on the library tab until the reader is ready.
- if the items are not loaded yet, use a placeholder
icon for tabs. Fixes: #4150
- special handling for reader loading message during initial
load. When an unloaded tab is selected, the loading message
needs to be displayed but, since there is no reader yet, we
add it in Zotero_Tabs.select and try to remove by the reader
when it's loaded.