-
Notifications
You must be signed in to change notification settings - Fork 1
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
Brainstorming #1
Comments
Hi Lea, thanks for all the well thought out comments! Here are some of my thoughts on the things you brought up: I agree a simple extra
The equivalent Mavo code I suppose would be:
However, I think having an With respect to your proposed syntaxes: With respect to the implementation challenges to consider:
|
As I have mentioned before, we cannot use a value for Furthermore, I'm not convinced sorting needs to be a new language construct. We can (and probably should) just define a New language constructs are harder to learn and cannot usually be guessed, so I'm usually in favor of them only when they significantly improve readability. For example, look at spreadsheets, probably the most successful end-user programming paradigm today: Most things are implemented via helper functions, so all a user needs to do is lookup the right function for what they want to do, instead of having to learn a new language construct. However, for certain things, having to use functions is tedious. Concatenation is a good example: A Good point about
@karger, thoughts?
So your list can be sortable or editable but not both?! Why? That makes no sense to an author or user. Yes, there are challenges that we need to solve, but IMO disabling editing is a cop-out. Worst case, we just disable drag and drop, which seems to be the trickiest one and doesn't make much sense (but should still be possible to drag & drop between lists, if there's a relevant
Not at all. Let me try again: There is no element in your HTML that represents Collection objects. The |
To the I also agree with your comments about not needing sorting as a separate language construct, so perhaps I shouldn't spend too much time trying to defend an example I don't support in the first place. In your proposed
To this point, I don't think I'm proposing that lists can't be both sortable and editable, and when I proposed disabling editing, I only proposed disabling editing on the sorted data, and having the actual edits take place on the unsorted version of the data. Although, after some thinking, I think there might be a way to make this work. One idea is when clicking edit, a user can switch between editing the sorted data and the unsorted underlying data (perhaps by using tabs?). In the sorted 'tab' (I'm going to use the term 'tab' for now as that's the first thing I think of in terms of how this would be displayed to the user), the users can perform drag and drops to reorder how the data is displayed in that specific element. This give the user control over how they want sorted data displayed without affecting the order of the underlying data. For example, say a user wants 2 specific elements at the top of a collection, and every other element afterwards sorted by age, and they want to make these changes via drag and drop. The downside of allowing this is that in order to store this new order of the data, we'd have to store another custom-ordered version of the data in mv-storage (unless we're going to accept this order as the new order of the original data, which I'm not sure is a good idea, especially if we end up deciding that we will allow multiple In the unsorted tab, performing edits works in exactly the same way that they work now, so I won't go in depth here. My only concern is how to make it intuitive to the user the difference between making edits on the way the data is displayed (the sorted version), and how the data is stored (the unsorted version), especially since Mavo has had a great emphasis thus far on strongly connecting the way the data is displayed with how it is stored (what you see is how it is in mv-storage). Ah I think I understand what you mean by your last bullet point, are you worried about the case where the user puts in a value for |
I see. Yes, it would be possible, though I'm not sure whether it would be desirable. Is there any argument to support doing it in the property name? "Angular does it" is not one. Angular originally tried to get novices to use it, failed, then pivoted and became an MVC framework for web developers. Since we don't want that fate for Mavo, we should be careful about taking its syntax as an example to follow. Yes, it's successful, but not in our target group. We should certainly look at it and how it solved the same problems, because there are a lot of smart people working on it, but we shouldn't necessarily follow those solutions without evaluating them on a case-by-case basis first.
👍 (I wrote the paragraph above before seeing this)
Yes, and it's open to discussion how that could work and what the default should be. We could either use a +/- prefix, an optional
I think we need to separate what we mean by "editing" here. There is absolutely no reason to disable or change the editing of property values for example. It's only collection editing (adding, deleting, rearranging items) that brings some challenges.
You raise a very good point here: that users or authors may want to override the sort for specific items, akin to "pinned" topics on a discussion forum. I'm not sure this is something that should be exposed to end users by default (any addition to the UI for end users comes with a ton of baggage, so we should be very conservative about it), but it should be possible for authors to put that together with the syntax we pick. And I think it already is: If the author wants such a thing, they could have a property (e.g. a As for the challenges in that, we've so far only discussed drag & drop. What about adding items? Where do they go? What about editing properties that are involved in the sort? When does the item move so that the experience is not jarring? These are challenges we need to think about, we can't just disable adding items or editing properties. But as far as drag & drop goes, I'm ok with disabling it. It's nonsensical in a sorted collection. I would suggest not just hiding it, but adding a
Yes. We do, but we probably don't want to show an error to the end user for something like this, we can just display it in the console. There is also the Mavo debugger, but it is currently broken. I want to add a small helper function for warnings like this that displays them in the Mavo debugger if it's loaded, or just via |
Right sorry, I used the term "edit" pretty loosely here. Yes I think there's no reason to disable editing of property values, but collection editing is what would pose issues.
I envision one potential flow for adding items as follows:
For editing properties involved in the sort, I also think the item should stay in its spot until the user unfocuses the element, at that point that's a trigger to reevaluate the state of if the list should be sorted, and have the item animate to its new spot. Another option that I thought of was having a resort button visible in edit mode. While making edits, the data stays put (does not automatically resort itself). After having made whatever changes the user desires, the user can click this button to see the new sorted data. Also, saving and exiting edit mode, we should resort the data by default using this implementation.
I agree, there's not really an expected behavior that we can abide by with respected to sorted collection drag and drop, so disabling it seems like the most appropriate course of action. The additional tooltip information and disabled attribute will definitely help hit the point home to our users as well.
This sounds good to me. Another thought I'm going to throw into the mix is that our syntax should also support sorting by nested properties (e.g. Also you mentioned providing a |
That makes sense. However, I just realized something:
Unfocuses which element? The property editor? Yes, as a minimum it shouldn't move with every keystroke. In any case, we can't just abruptly move it, that will be very jarring. Animation can help to show what's happening, but we still need to think what to animate.
That doesn't seem like a good idea, for the following reasons:
Of course. However, remember that there is a well-defined algorithm for resolving property references from anywhere in the Mavo app without the need for the dot notation except for disambiguation. The same should work here, which probably means that the code should be abstracted away from
In addition, as it solves different use cases. For example, imagine you have a collection of people and you want to show all names somewhere, alphabetically. If all you had was It may be a good idea to start with |
I'd like to consider use cases before getting to syntax. What kinds of things do we see on the web today?
Are there any other categories? I can't think of any sites that let users both edit data and sort data---can you? So one easy out is for us not to offer this functionality (at least for now). If we do want to offer both, perhaps a simplification would be that sorting is disabled whenever editing is enabled, and vice versa. In particular if you've sorted the data, then activate editing, the data stays in its currently sorted order but doesn't re-sort while editing is happening. When the user exists edit mode the data re-sorts with its new data. This also means you wouldn't be able to apply sorting to a collection with auto-edit/auto-save activated. |
Another approach that simplifies many things (but comes with its own issues) is to consider sorting as a data manipulation action instead of as a functional dependency. That is, instead of saying "the collection is a reactive function of the sort specification, like other spreadsheet function", we say "sorting the collection is a data manipulation action, like dragging a single item out of order." This fixes some of the problems observed above. For example, if I have a "sorted" collection and drag an item, that's fine---I've changed the order to a different order. If I want it to go back to being sorted, I have to invoke the sort again. Similarly, if I add an item, it stays where I added it, because that's the order I specified. Not that this is a compelling example, but this is how app managment seems to work on my (android) phone. I can get a list of apps, and whenever I want I can sort it A-Z. However, if I add a new app, it shows up at the end---after the Zs. If I want to get a sorted list again, I have to reinvoke the sort. We could, of course, offer an "auto-sort" override that the author can use to specify that the collection should be kept sorted always (drag and drop disabled, adds jump to the right place, etc.). One potential issue here is that if we literally think of sorting as a data manipulation then when we save the data we'll need to save it in the newly sorted order. Which would really mess up the version control diff functions on github, as they don't do well with re-ordering. I suppose we could think of this as a kind of "soft" data manipulation that doesn't get saved. Alternatively we could save the state of the sort (e.g. what is the chosen sort property) with the data in original order instead of changing the actual data order. But this could get in trouble if e.g. someone sorts and then starts dragging items---the order no longer has a compact representation. The idea that sorting is a manipulation can be extended to filtering, although in that case we certainly don't want to save the result of the manipulation since it would cause data loss. But the concept that inserting an item into filtered data set leaves it visible there even if it doesn't fit the filter, since the filter "finished previous to the insert" and is no longer enforcing. this could all also coexist with a sort function that is reactive and instantly updating and so on. |
I think one thing we should also decide is if we want multiple |
Not sure I follow. If multiple collections are used for the same data, one is the canonical one that is saved and the rest are via |
I can't remember if I already emailed this, but if we're thinking about sorting we should also think about grouping, and in particular what syntax would allow someone to specify that e.g. they want to sort their cities by country but also want a header for each country (containing at min the name of the country, but perhaps you want to format other info into the head as well). |
Not sure about modifying the user’s template. Perhaps we can make this available via expressions… |
Hi, just wanted to bump this conversation so we can flesh out any final details so development can start. It's sounding like we were somewhat agreeing on having an mv-sort item not be editable? (In mv-storage, collection is unsorted, displayed as sorted to user, user can make changes to each item, but cannot make collection changes like reordering) Is this still true? If so, unless there's other discussion points, perhaps development can start? |
I don’t see any such consensus. @karger you want to clarify your views a bit? I recall when we discussed this f2f you said you were not suggesting to disable editing while the data is sorted. |
I believe I misspoke, when I said mv-sort item, I meant the the mv-sort collection. So individual item editing still allowed, but resorting not allowed. It might get confusing, so when talking about editing let's try and specify if we're talking about collection or item editing. |
The only thing I see consensus on is that drag & drop should be disabled when sorting.
Several solutions have been proposed that include:
But no consensus. In any case, sometimes it's easier to experiment with ideas when they are more concrete, so if you want to start coding and accept that you may have to completely change the behavior, then that's fine by me (but do wait for @karger to opine as well). |
So in that case, I'll at least start on an implementation where drag and
drop is not allowed when sorting, and we can figure out adding items,
deleting items, and property editing behavior as we go.
Does this sound good?
…On Mon, Aug 7, 2017 at 12:44 AM, Lea Verou ***@***.***> wrote:
The only thing I see consensus on is that drag & drop should be disabled
when sorting.
I don't see consensus on:
- Adding items
- Deleting items (why disable that?!)
- Editing properties (if they participate in the sort, resorting as
you type may be jarring)
Several solutions have been proposed that include:
- Disabling editing altogether
- Certain ways to handle the issues, e.g. to smoothly scroll to
new/resorted items
- Not updating the sort while editing
But no consensus. In any case, sometimes it's easier to experiment with
ideas when they are more concrete, so if you want to start coding and
accept that you may have to completely change the behavior, then that's
fine by me (but do wait for @karger <https://github.com/karger> to opine
as well).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADdHTFABNUFG4COT-wnaeMj-ddygjNJgks5sVsBJgaJpZM4OBnmt>
.
--
All the best,
Daniel Sanchez
|
@LeaVerou 's proposed improvements to the current state of sorting:
|
Sorting could be as simple as an
mv-sort
property. Its value could be hardcoded, or set via an expression (so you'd need to use mutation observers to monitor changes — Mavo has a helper for that). Both hardcoded and dynamic sorting has use cases. If set via an expression, it's trivial to make a sorting widget:It may be useful to introduce a meta function that returns all property names within a scope, to make it possible to auto-populate such widgets.
The
mv-sort
attribute should accept multiple fields, and there should be some kind of designator for descending instead of ascending sort.Here are two possible syntaxes with their pros and cons:
mv-sort="name desc, date"
. Con: comma-separated attributes do not naturally occur in any other part of HTML exceptsrcset
and there is no CSS selector for them like the~=
for space-separated ones and the|=
for hyphen-separated ones. Pro: Very readable.+
or-
for ascending and descending, e.g.mv-sort="-name +date
or just-name date
since ascending is the default. Pro: short and clear, con: less readable. In natural language we'd use commas.One could argue for optional commas, but the SVG WG tried to do that in SVG and it proved a terrible idea.
Some implementation challenges to consider:
mv-sort
is actually on the item. However, this is less problematic than other cases, becausemv-sort
has no meaning on the item. With most reasonable use, the expression used within would have the same value for the entire collection, because having a different sort per item is nonsensical. But what happens if that is not true? This is probably always a mistake, but we need to decide what to do there.The text was updated successfully, but these errors were encountered: