-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Feature/entry number for display and navigation #1215
Feature/entry number for display and navigation #1215
Conversation
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.
Nice work Rick! This will be a nice improvement, especially for Margarete who is having difficulty navigating her dictionary. I would like to know if the <form ngSubmit>
idea is feasible. If it's not then let me know and I will approve as is. Thanks for checking that out. Let me know if you have questions.
gotoToEntry(index: number, isValid: boolean) { | ||
if (isValid) { | ||
let id = this.editorService.getIdInFilteredList(Number(index)); | ||
this.editEntryAndScroll(id); | ||
let gotoElement = (<HTMLInputElement>document.getElementById('goto')); | ||
gotoElement.value = ''; | ||
} | ||
} |
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.
It feels like the function name should be goToEntry() instead of
gotoToEntry` Can you rename?
The if statement around validation isn't very nice, since I believe AngularJS has built-in validation as part of a form using ngSubmit. e.g. you could wrap the input in a
and I think the min / max validation will happen for free. No need to pass in the form validation state.That's what I'm thinking in my head, however I haven't tried it out. Let me know how you get on.
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.
There already is a function with that name line 921 goToEntry(entryId: string)
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.
For the ngSubmit suggestion to work would require an input type of "submit" the text box is input type of "numeric"
@@ -13,7 +13,7 @@ | |||
<div class="comment-bubble-entry"> | |||
<comment-bubble control="$ctrl.control" field="$ctrl.fieldName" model="$ctrl.model" parent-context-guid="$ctrl.contextGuid"></comment-bubble> | |||
</div> | |||
Entry | |||
Entry, Number: {{$ctrl.entryIndex}} |
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 addition intentional?
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 was discussed in Slack, Alex liked the suggestion to add the entry number to the card.
https://sil-language-software.slack.com/archives/CGDKZ7NTV/p1633621109496300
@palmtreefrb I'm sorry to keep you waiting on this one. Your PR work and the discussion we had at standup last week revealed that this feature was not as well defined as I thought. Here are my revised UX requirements. I think you almost have it.
|
2078a23
to
e401994
Compare
I was testing this feature today, to approve it, and found a bug. Point 2 of #1215 (comment) says:
If the entry number input is edited and you press Enter, while there is no filter in place, this works correctly. Typing in 5 and pressing Enter jumped me to entry number 5, as it should. However, if there is a filter in place, then typing in the entry number input and pressing Enter does not behave correctly. I set a filter that showed only two items, then I typed 5 into the input and pressed Enter. Expected result: I get jumped to entry number 5 (the fifth entry in the unfiltered list). This is good work, and I'm looking forward to getting it merged in once all the bugs are fixed. |
Looked at it again, and I missed the part of the design where it says that the entry number input should also be grayed out along with the Previous/Next buttons. So forget what I said about expected behavior when typing into the entry number input with a filter in place. It's actually supposed to be disabled in that circumstance. So the bug report is just "entry number input wasn't disabled when Previous/Next buttons were disabled". This was in Firefox on Linux, in case that matters. |
@palmtreefrb I've been out of action for several weeks and I think once you address @rmunn 's bug, and he tests it, then we can merge this. Looks like a rebase is in order too. |
The bug is fixed and I have rebased this branch with develop. |
I pulled the latest version of the branch and built it, and I can still type into the entry number input when there's an active filter. It's not actually disabled yet. Also, I've found a bug: when you type a search expression into the filter, the entry number can change, without any apparent cause. For example, here's what happens when there is no filter and I have the sixth item selected: Now I type It seems very unintuitive to have the entry number change from 6 to 8 when I added a filter expression. (After I typed the letter Actually, the bug might not even be in your code, @palmtreefrb. The logic around the filtered list view is complex enough that we could actually have some other bugs in there, that your code is merely exposing but not causing. But before we can merge this PR, we certainly do need to find and fix those bugs, because if the user sees the entry number jump around it will be very confusing. |
Found another behavior I'm not entirely happy with. When you type in the filter list view, the entry number input becomes red once it's out of range. E.g. you're viewing entry number 6, but you've filtered the list view so it only shows 2 items. The entry input box shows 6 and has a red border. I don't believe we should show a red border around the entry input field when it's disabled. The red border (validation failed) should only be displayed when the input is enabled and incorrect. So if the field is being correctly disabled when a filter is applied, then there's no need to change the validation logic. You'll just need to have the red border show up when the field is enabled AND the validation has failed. I think I would add a couple more requirements to the list that Chris made above:
In particular, the entry number should not change when filtering items. It will end up showing a number that's outside the range, but if I was looking at entry number 6 in the unfiltered list, filtering the list should not tell me I'm looking at entry number 8. Now for the "clicks on a different item in the list" part. In my testing, I filtered the list by typing In other words, there's another new requirement coming out of my testing:
This might be a new requirement that you weren't aware of, in which case I apologize for the extra work that it will take to meet this requirement. But I'm pretty sure this is always how we intended the feature to work. |
Found one reason for the entry input not being disabled. You've created a Fortunately, the fix is simple. There's already a In other words, this should fix that part of the issue. diff --git a/src/angular-app/languageforge/lexicon/editor/editor.component.ts b/src/angular-app/languageforge/lexicon/editor/editor.component.ts
index 597dc7b65..d8b2dcacc 100644
--- a/src/angular-app/languageforge/lexicon/editor/editor.component.ts
+++ b/src/angular-app/languageforge/lexicon/editor/editor.component.ts
@@ -317,8 +317,7 @@ export class LexiconEditorController implements angular.IController {
filterIsOn() {
const mod = this.entryListModifiers;
- let on = mod.filterBy != null && mod.filterBy.option !=null;
- return on;
+ return mod.filterActive();
}
shouldShowFilterReset() { I've tested this and it does disable the entry number input correctly. The input still shows red when it's disabled, and it shouldn't, but that's a different issue I don't have time to track down right now. |
Robin, this was by design.The requirement was to disable the index search when a filter was applied. Shouldn't we allow a search if only sorting the list? |
The filterActive = () => !!(this.filterText() || this.filterBy && this.filterBy.option); That won't consider the sort at all, but it will consider the Sorting is an issue I hadn't considered. Do we want the entry number to change when the user reverses the sort order, or not? The way the code is right now, if I click on entry 1 of my 30-entry project and reverse the sort order, the entry number field becomes 30. If I click on entry 2 and reverse the sort order, it becomes 29. My gut feeling is this is not what users are expecting, and that we should make the entry number be "the entry's order in the normally-sorted order of the dictionary", not the current sort selection. But I could see an argument either way for it, and that's something we can discuss at our next standup meeting. At the moment, though, the |
After further review of the LF code, it seems that some of the issues with the entry number jumping around are difficult to solve and aren't something that this PR introduces. For example, sorting entries actually changes the |
I had come to this very same conclusion after diving deeper into the workings of the filter and sort implementation code and wanted to discus on the next stand-up. |
…ion ng-disabled to back, forward and goto elements
…y entry-index="$ctrl.entryIndex() removed on rebase, adding back
e223e20
to
2f3e08f
Compare
This change adds a ng-blur handler that resets the value of the numeric input to the current entry index. This fixes the input having a sticky invalid state/red box when the user clicks a button or loses focus on the input. Additionally, we hide the controls when the filter is active, instead of disabling.
This latest commit fixes the misbehaving red box behavior on blur and hides the control completely when the filter is active, thereby avoiding the wonky behavior discussed earlier in this PR. Here is a demo of the control working after this latest commit. @palmtreefrb and @longrunningprocess wanted to get your review on this before merging. |
@josephmyers and I paired on this PR today and also had a bit of a design discussion on moving the entry index navigation closer to the entry list UI, which is captured in #1274 |
Description
This PR will allow users to enter an index number to move focus to an entry. With the below features.
Should display the current entry's index number (1-based)
Should be editable
Should protect against invalid input, including numbers out of range (revert to current entry number)
Upon user typing valid entry number, should navigate to that entry
For desktop and mobile.
Type of Change
Only keep lines below that describe this change, then delete the rest.
Screenshots
How Has This Been Tested?
Checklist: