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
Svelte Tag Editor v2 #1264
Svelte Tag Editor v2 #1264
Conversation
Looking forward to this! I gave it a brief try, but got a JS error when I tried to select one of the completions, so I presume that's still a work in progress. Once 2.1.45's out the door and any release issues dealt with, I can help with the Rust side of things if required. Some sort of weighting system for the search results would be nice, as we briefly discussed in the past. |
Actually rebasing caused the JS errors to occur (probably Bootstrap 5.0.2), and it has to do with the |
Have only given it a brief play so far, but seems to work well after that DropDown fix :-) |
This is such a cool PR! SuggestionExtra long (hierarchical) tags feel a bit out of place with this new look. Short tags (like marked, leech, WIP, etc.) and hierarchical tags seem like two separate concepts that deserve separate treatment. I wonder if there is a neat way to remedy this. Perhaps you could make hierarchical tags collapse, only show the last node of the hierarchy with a visual indication that it is hierarchical? If that is too radical of an idea, I would suggest to make the text cut off to the left, like it did previously, since the last nodes of a hierarchy contain the info that is most relevant to the current note. |
I like the collapsing idea. An issue is that each row that the tags create, takes away from the space that is left to navigate the fields. The following is a note from the Anking deck with quite a lot of tags: Idea 1: This what looks like if the tags were collapsed to their last segment: Two instead of six rows. We could show the full tag on hover, which would still make it very discoverable. Idea 2: However we could also (even in addition) collapse the tags themselves, and show an icon ( On mobile, if we make the tags nowrap, and allow for vertical scrolling maybe the problem does not even arise? |
Idea 1 looks very promising to me. It removes a lot of redundant information and I believe everyone will intuitively understand the meaning of
Perhaps a full reveal on click (in edit mode) would already be enough? I fear that hovering/expanding long tags could cause a major displacement of other tags, which could get frustrating if it happens on accident. |
I meant, revealed as a tooltip! I forgot to mention that :) |
Idea 1 looks great. If full is shown on hover + edit, presumably that'll make most people happy? |
5dc426b
to
283cdbe
Compare
(We'll likely need a few hotfix releases after 2.1.45, so I'd like to hold off on merging non-trivial changes for a week or two) |
AnkiWeb stuff has dragged on a bit, but hopefully after this weekend I'll be able to look into the Rust part of this. Looking forward to playing with it with real data :-) One thing I noticed - with the old editor, hitting enter will complete the top match, but it now accepts the tag as typed. It appears you can accomplish similar by pressing tab instead, though the completions move from the bottom rather than the top, which feels a bit strange - was that deliberate? |
It was deliberate, yes. My reasoning was the following:
That's why I decided to reverse the order you tab through suggestions. However I'm open to suggestions. :) P.S. |
The old Qt dropdown will only show about 6 matches at once. Couldn't we do the same thing with the dropup? That would mean the first match would always appear in a predictable place. It wouldn't be directly next to the input box, but if the top entry is highlighted, the eye should be able to jump to it fairly easily. I appreciate what you're trying to achieve by having the matches start next to the input area, but I have a feeling users will find the inverted navigation a bit difficult to get used to. WDYT? ctrl/shift click features sound handy! |
I've pushed the Rust end of things into this branch. It wasn't clear to me how I should be grabbing the candidate string for completion, so I've left that part for you. What's the goal of the unicode component separator by the way? |
Sorry, had a typo - have force-pushed a fix. |
After some more thorough testing, I have accumulated this list of remaining issues:
EDIT: Playing around with the Anking deck, if there around 4.7k~ suggestions it causes a lag of around 2 seconds. Currently I display 6 suggestions at a time (the container being scrollable). Maybe we could display a few more suggestions at a time (8~12), but make the cutoff for fetching suggestions at a lower number, so we avoid a lag when typing at any cost. I really don't know which one is the more typical use case:
Maybe @AnKingMed could help out here. |
* Fixes deck-options dropdown not showing. It seems like it's no longer necessary
@hgiesel how can I help? Most of my tags are very long and there are ~10-15 per card but I'm not sure what you need from me to assist on this |
@AnKingMed What I did was enter
So, which one do you think is more important? Make typing lag-free or provide more tag suggestions? Or, how long could you accept the lag to be, if it means you get more suggestions? |
I see what you mean now. At the moment |
This is looking great Henrik, and almost ready for merging I think. A couple of issues I noticed:
wrap.mp4
hover.mp4 |
+ convert from u32 in backend method
Just pushed a very minor change to the Rust code. One other thing I noticed - currently with focus on Front, pressing tab once jumps to Back, but pressing Tab again does not move to the tag input area. Would it be easy to fix that? |
How would you suggest to change this behavior? The jQuery tag editor shows the same behavior. One thing I could imagine is that clicking the AddTag icon / using Ctrl+Shift+T shortcut, puts the TagInput before the first tag (closer to the icon), which would prevent the completion area from shifting, only the tags that follow it.
I've been wary about that because there might be users with colons in the tag hierarchy, like
I know this is a change to before, but I thought it makes most sense for several reasons:
|
Would making the dropup be the width of the entire input area + anchored to the top of the input area make sense/be practical to implement? No strong feelings here, just throwing out ideas.
I think like the reversed tab order change, this might be a bit surprising to users who are used to new things being added on the right.
Fair enough - it's already a lot better now that the completions don't disappear.
Yep, good point. Happy to run with it for now; let's see what users think. Thanks for all your work on this Henrik! |
FYI this PR introduced a regression with the ImageEditor (because I introduced a bug into
This would probably mean that all tags have to share one dropdown. I previously had issues with this, but I could give it a try. This would give the suggestions a fixed place which would indeed be nice. |
Might be worth a try, as it would also match the old behaviour. But if it proves to be difficult to implement, no need to spend too long on it. |
This issue seems to be back again - it seems to happen when you press up/down to select a tag that scrolls off the screen. |
I'll give this a look now. |
Take 2. Closes #1079.
Disclaimer: This is not supposed to go with 2.1.45. So be free to ignore it, while .45 is not out yet.
Notes:
I tried to emulate the visuals of the tag editor on iOS, and the functionality of the tag editor on Desktop. Two ways you can see this is using arrows keys, to navigate between the tags, and using backspace (or delete) to delete beyond tags.
WithAutocomplete
is a very general component, that could also be reused in a wide variety of scenarios. I actually thought it could be useful, when we implement the NoteType / Deck selector in Svelte, and we don't go with a modal.The Tag badge (same icon as in browser) is clickable, and replaces exposes the "Focus Tags" shortcut. Clicking the badge behaves slightly different from the shortcut. Clicking the badge will always focus the new tag input, whereas the shortcut toggles it.
nowrap
, we could also set the tagsnowrap
, and make the "AddTag" icon sticky, that way users could still easy add new tags, even thought the end of the tags is beyond the viewport.The autocomplete currently has one randomly generated item. This shows you when the suggestions would update.
Instead of Ctrl+Tab, just Tab will navigate the menu. Ctrl+Tab is reserved on macOS (App switcher).
Tab + Shift-Tab + Enter
. HoweverUp + Down + Right
works just as well. Selecting an autocompletion item will move the caret to the end of the tag, and pressing right will open a new tag to the right (if the tag is the last one).The autocomplete navigates bottom to top when it is a dropup (most relevant item will be at the bottom).
Entering a duplicate will highlight the old one and discard the new one.
Todos:
row
instead ofrow-reverse
) (Autocomplete for the tag editor will always be a dropup now)nowrap
version.