On 2016-12-19 6:59 PM, Mats Palmgren wrote: > I've made an example Grid to illustrate that last point, try selecting > the first column then the second (first some A's then some B's) > (you need Nightly or DevEdition for the example to work): > https://people-mozilla.org/~mpalmgren/tests/grid/grid-selection.html > I agree with Tab that this is going to happen *a lot*.
I admit that I don't understand CSS Grids, but looking at the markup, I understand the use case. It's hard to think how this can be fixed without multi-range selections. This is actually a great example in that in invalidates my previous suggestion about perhaps only not supporting user-made selections with multiple ranges in editable areas. :-( It's unreasonable to expect selections to be broken when editing a document that uses grids. I think this may end up forcing our hand here. The only remaining option that I can see is fixing our code to deal with multi-range selections. > I think we should work with Ryosuke to develop a better Selection API > so that handling multi-range Selection comes naturally. That part > doesn't seem that hard to me; the problem is mostly about getting web > developers to use the new API, but if we can make it just a little bit > nicer than getRangeAt() then I believe we can win them over. The current API isn't the most modern but it is similar to many other DOM APIs with a count attribute and a getter(index) method. What do you think is wrong with it? I don't think the assumption that the only thing that developers need to change is the syntax they use to use another function such as forEachRange() is necessarily correct. Depending on what the code does, it may need restructuring to properly support multiple ranges. There may be many assumptions around only a single range baked in the existing code. I think the much more interesting thing to focus on is defining the semantics of multi-range selections in that spec. The semantics of handling them in editing operation probably needs some consideration too. >> * The user facing functionality. Currently we expose multi-range >> selections to the user in the following ways (perhaps among others that >> I'm missing?): >> >> * Table cell selection (by Ctrl/Cmd-clicking on several table cells >> allows you to select them all) >> * Mouse based selection (by holding Ctrl/Cmd when selecting something >> on a page with another selection present) >> * (and perhaps touch based selection also similarly, but I don't have >> a device I can test that on) > > * user selection over CSS '-moz-user-select:none' regions Ah, yes! > * user selection in CSS Grid layout (eventually :-) ) > Cheers, Ehsan _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform