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.
- Use SVG icons
- Show "[x] collection selected" or "[x] searches selected" in the item pane
- Show "[x] objects selected" if multiple types are selected, which I
don't love, but I don't have a better idea
- Use existing strings for ARIA labels
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.
Previously we were redownloading only `SYNC_STATE_TO_DOWNLOAD` files,
not `SYNC_STATE_FORCE_DOWNLOAD`, because the latter gets downloaded even
when using on-demand file syncing, but if the download fails for some
reason, it should be retried on a manual open.
If the header is in bibliography entry mode.
Instead of trying to focus editable-text of the header (which
may not be possible), just focus the next node after the header.
- Add pagination, limits, and Link header
- Add schema endpoints and dummy /settings endpoint
- Add /file endpoints
- Browser security restrictions prevent the web library from actually loading
the file: URIs that the local API returns, but out-of-browser use will work
fine
- Add toResponseJSONAsync() DataObject function: delegates to toResponseJSON()
by default, adds information that requires awaiting promises
- Best attachment (links.attachment) and file size (links.enclosure.length)
for items, meta.numItems for groups
- Separate function for compatibility with the existing test code that uses
toResponseJSON(), but we could consider unifying
This commit does not add the Access-Control headers that allow webpages to make
requests to the local API, since I don't think we actually want that.
This required some tweaks to other parts of Zotero infrastructure:
- Search:
- Add 'includeDeleted' condition to match behavior of 'includeTrashed' API
parameter in a single search
- Data objects:
- Improve toResponseJSON() implementations so output better matches the web
API
- Add toResponseJSON() to Zotero.Tags - has to be async so it can query the
database and generally works differently from other toResponseJSON()
functions, but accomplishes the same task
- Remove unused getAPIData() and apiDataGenerator() DataObject functions. They
aren't functional and wouldn't really make implementing the local server
easier, so now seemed like a decent time to remove them
- Server:
- Support resolving routes using pathparser.jsm
- Add allowMissingParams option to PathParser#add(): prevents /route from
matching /route/:param
- Replace the query property of the data object sent to endpoint init()s with
searchParams, an instance of URLSearchParams - supports #getAll() for
repeatable parameters
- URIs:
- Make getObjectURI() public, add utilities for converting URIs to API
endpoints and web library URLs
- Set the window minimum size to 700px x 500px.
- Fix a regression where non-applicable operators remain visible.
- Fix the "✔️" appearing next to multiple operators in the operator popup menu.
- Include the "Year" and "Attachments" columns by default in the results table.
- richlistbox shift-click selects a range starting with
_selectionStart. After a few cmd/ctrl clicks, _selectionStart
ends up not being correct - it can even point at an unselected item.
To help richlistbox properly select a range, before each click is
processed, reset _selectionStart to be either the first
or last selected item, depending on where shift-click landed.
- also, fixed a small glitch where inputs would be created if
you click on the red border outside of the actual editor.
Fixes: #4206
Use a regular paragraph for the intro text rather than an input
placeholder, which gets cut off it's too long, and allow the window to
be sized dynamically based on the title and localized strings.
Fixes#4109
"Note format" section in "Export" tab is technically a table and is
announced as such by screen readers, which is misleading.
It also opens a menulist when a checkbox is clicked, which is
not an expected behavior and can shift focus.
This refactors the "Note format" section to be a vbox container
with <checkbox>es and labels, which is more correct semantically and
does not confuse screen readers. In addition, when a chekbox is
clicked, dispatch a "change" event instead of unnecessarily open
up a menu.
- linked input/output file labels to the input fields so
they have descriptive names
- added more detailed button labels
- fixed "No file selected" not appearing if no file is selected
In libraries, notes and tags boxes, do not hide the actual
"-" toolbarbutton, hide the <image> inside of it. Visually,
it looks the same but the button can be focused via tab
without having to expicitly make it visible. It means that
shift-tab from the section header will not skip the "-" button.
Also, make "remove" toolbarbutton from tagsbox focusable like all
others for consistency.
- Linked remaining found inputs/menulists to their labels.
- Made the "Choose resolver" a proper visible
label, so that it does not oddly disappear if you click
on the dropdown with "Custom" showing after even if the
selection did not change. For the purpose of VPAT, a
visible label is always good for success criteria 3.3.2
https://www.w3.org/WAI/WCAG21/Understanding/labels-or-instructions
- Added explicit names to +/- buttons
- aria-labelledBy for inputs surrounded by text
- fluent strings for resolver preferences
- remove openURL.version preference, hardcode "1.0"
- added 8px padding around text on linux. Mac and win already have some
padding around text through --panel-padding. Fixes: zotero#4187
- guidancePanel.js fetches text from .ftl file instead of zotero.properties
- added first-run-guidance-quickFormat to zotero.ftl with updated
text to better reflect current functionality. Fixes: zotero#4191
- removed unnecessary special treatment for qf guidance panel on mac
- moved guidance panel text for itemBox creator menu into zotero.ftl
---------
strings tweaked by @dstillman
- multiple reference items can be selected with
shift-arrowUp/Down or Cmd/Ctrl-click and added as bubbles
via Enter or click on one of selected items
- Shift-click can be used to select the range of items
- if there is a retracted item among multiselected
that is not OK'd (cancel or view in library clicked),
no bubbles are added and the item is removed from
the multiselection
- added a red note to item's description indicating
if an item is retracted
* Improve feed item pane header (fixes#4141)
* Show item pane custom head when headerMode is none (fixes#4116)
* fx115: Fix button style on windows (fixes#4120)
* Move split-menu-button styles to SCSS
isSnapshotAttachment() checks the link mode (needs to be IMPORTED_URL),
but we actually allow viewing all attachments with text/html MIME types
as "snapshots" in the reader. Don't throw on any HTML attachment that
the reader is willing to open.
- 59afef6 added a duplicate assignment to item.rights that was putting
a TextConstruct(!!!!) in the item JSON field instead of a string
- info.rights was being set to a TextConstruct (preexisting issue!)
The 'blur' event needs to be dispatched by editable-text
before its state is reset (not after) because tagsbox uses
.initialValue in the 'blur' handler.
followup to 101e6d55d5Fixes: #3575
- fix the infinite loop glitch. Tweak of editable-text to only
dispatch 'blur' event if the input was actually blured. It prevents
the hideEditor from being locked in an infinite loop due to the
call stack hideEditor -> modifyCreator -> moveCreator -> blur -> hideEditor
- refactor blurOpenField to not be async and to not be used in most
places. It is mainly redundant now that editable-text handles blur
if clicked anywhere outside of it, so it helps to avoid confusion.
- since moveCreator does not await or yield for anything anymore, remove the
Zotero.spawn part. The rest of the function is unchanged.
- on focusin of the empty unsaved creator row, use its future unsaved id
that reflects its positioning instead of its real id (which technically is
the very last creator row). That way, a tab from a creator row that was just
filled will land to the proper component after render, as opposed to
focusing the very last row.
- similar approach to removing the unsaved creator row when the focus is
in it - focus the row above it, as opposed to the last row.
Fixes: #4145
Addresses part of: #4143
- plus button is enabled on all creator rows, not just the last one
- enabled plus button will add an empty unsaved creator row below
current creator row. After that, plus button is disabled as long as
the next row is unsaved.
- the grippy of a newly added unsaved row is disabled
- adding an unsaved creator row will remove another unsaved creator row
if one exists. That way, only one unsaved row can exist at a time
- once the unsaved creator row is added, it is tentatively perceived as
the "last" creator row based on its id. That is to avoid shifting all
other creators' indicies and saving the item too many times. When the
field is blurred, that new creator is moved into its "unsavedIndex"
before saving the item
Fix to a glitch where after switching creator field mode, the
autocomplete suggestions for creators would still be for the old mode.
This only happened if the field mode was changed on an empty, unsaved
creator row.
- removed ztabindex logic from itemBox. It is no longer needed, adds
unnecessary complexity and is likely at the root of multiple glitches
if a plugin inserts an arbitrary row that does not have ztabindex set.
- if a creator row is deleted when the focus is inside of the row, focus
another creator row to not loose the focus.
- more centralized button handling in `_ensureButtonsFocusable` and
`_updateCreatorButtonsStatus`
- refactoring of hidden toolbarbuttons css so that the icons are still
hidden and don't occupy space (if desired) but are still visible for
screen readers, so they are focusable without JS changing their
visibility (this with ztabindex removal fixes vpat 24)
- removed `escape_enter` event from `editable-text`. It was a workaround
to know when itemBox should move focus back to itemTree. Unhandled
Enter on an input or Escape should focus itemTree (or reader) from
anywhere in the itemPane/contextPane (not just itemBox), so that logic
is moved to itemDetails.js. To avoid conflicts with Shift-Enter, do
not propagate that event outside of multiline editable-text. Fixes:
#3896
- removed not necessary keyboard nav handling from itemDetails.js. It
was only needed for mac, and is redundant if "Keyboard navigation"
setting is on
- using `keydown` instead of `keypress` for itemDetails keyboard nav
handling because `Enter` `keypress` does not seem to get out of
`editable-text` but `keydown` does.
- old handleKeyPress from itemBox is no longer relevant for most
elements, so it is removed and substituted with a dedicated handler
just for creator row.
- moved the creator's paste handler into its own dedicated function
from the autocomplete handler (which was confusing)
- special handling for `enter` and `escape` events on `editable-text`
with autocomplete to not stop event propagation, so that the events
can bubble and be handled in `itemDetails`. It avoids some cases of
the focus being lost and returned to the `window`. It was unnecessary
earlier due to `escape_enter` workaround but only within itemBox and
only within itemPane.
- removed explicit tab navigation handling from `collapsible-section`
header. Currently, it may get stuck when buttons are hidden (e.g. in
the trash mode). It was only added to enable keyboard navigation on
mac before special "Keyboard navigation" setting was discovered (it
was never an issue on windows), so now it's easier to just let mozilla
handle it.
- always use `getTitleField` to find and focus the proper title field in
itemBox
- on shift-tab from the focused tab, just move focus to the first
focusable element before the splitter without any special handling for
attachments, notes and duplicates pane as before. It ensures a more
consistent and predictable keyboard navigation, especially now that
itemPane is fairly keyboard accessible.
Fixes: #4076
:focus-within doesn't match when the window is inactive but the field
is focused.
Addresses #4101, except that focusing the new item's title field and
pressing Escape will clear the field (without modifying the item).
If a parent item and its primary attachment are selected, it should
still say "Show File" rather than "Show Files". This adds the
questionably named `Zotero.Items.numDistinctFileAttachmentsForLabel()`
to try to figure out if we're operating on 0, 1, or >1 items.
Follow-up to #4124
Fixes the issue where long press would not open up
context menu in a virtualized table and tab bar because
it was handled in mousedown events that longpress on a
touchscreen does not dispatch.
This behavior is still observed in the scrollable area
of the reader and the note editor.
Addresses: zotero#4094
When item is created manually, title field in itemBox
will be focused instead of the title in the itemPane as before.
If the itemBox is collapsed, it will be opened.
Added 'open' setter to item pane section for brevity
Fixes#4111
- revert debcb9944d since it breaks
drag-drop reordering of tabs
- when reader is being refocused by contextPane, add a small delay
so that the focus settles on the tab before focusing the reader
- also explicitly refocus the reader tab after drag, since then focus
also lands on the tab and finds itself outside of the reader
If the info section is collapsed, do not try to focus and
open the itemType menu as it can lead to an empty dropdown.
Just focus the header title in that case
After clicking on a reader tab, the reader will get focused
but the default mousedown event handler can then shift
focus onto the actual tab. It looks like the focus gets "lost",
and breaks reader keyboard shortcuts so we want to avoid it.
Mainly happens on windows.
Fixes: #4077
- If there are too many tabs opened to fit onto the screen,
the tabs menu can be scrolled
- When tabs menu is opened, scroll to the selected tab
- Use margins instead of padding to that the scrollbar does not
overlap with the cross button
- Make sure that if the tabs menu is long, there will
be a gap between it's top/bottom and the edge of the
screen
- On linux, screen.availTop and screen.availHeight are not always
correct and the menu can go outside of what is supposed to be
the available screen area. Special treatment for those
edge cases
Fluent seems to clear out label/placeholders attributes set directly
(not via .ftl file). So quicksearch placeholder added directly ends
up being emptied out.
This is the cleanest workaround found so far: add the placeholder
as the fluent argument
Fixes: #4073
- do not erase the last recorded tag on blur of the tag selector
- on tab from collectionTree or shift-tab from tag selector input,
try to refocus that last focused tag. If one does not exist,
try to focus the first non-disabled tag.
Fixes: #4008