Comments (2)
Yes, I see how this is potentially confusing.
Fwiw, there are more uses cases than the one you describe. E.g., the selectors support multiple selection, where elements can come and go from the selection list without being in matched pairs. [Edit: ok, I see you considered this and put for 'single selection' in the issue title.]
Initially we had two separate events, but it became onerous to have to listen to two events, and it was simpler to have a single 'selection state changed for item' event.
Maybe there is a way to make everybody happy, will have to cogitate on it.
from polymer-elements.
I agree there's a lot to consider here. As you're thinking about this, here's some more food for thought:
- In my experience, scenarios with single-selection tend to vastly outnumber scenarios with multiple-selection. Mutli-selection is something of a pain to both design and code for: not only do you have the mechanics of multi-selection to deal with, you also generally have complex UI state that's dependent upon the selection. Maybe you have a list of email messages, and there are some commands (Reply, perhaps) that can't be applied to mutliple messages, so those need to get disabled depending on what's selected. For these reasons, apps generally reserve the hard work of supporting multi-selection on their main, centerpiece UI: the inbox, the file manager, etc. For everything else (lists in settings, tabs, menus, etc.), apps generally make users deal with things one at a time. I'm guessing that, of all the list-like things in UIs today, something like 90% of them are single-selection lists. If that's correct, the API for polymer-select feels optimized for the 10% case.
- From a user model point of view, in single-selection lists, switching the selection from one item to another is perceived as a single act — the user doesn't perceive a click in a list as deselecting one thing and selecting another. Instead, they just perceive the selection as having switched to a new item. Perhaps that's why, when I was trying to use this polymer-select event (without documentation), my instinct was to assume the event would be fired once for each user selection act.
- I can't think of many single-selection cases where I'd want to do something special when a particular item becomes deselected. The most common would be to revert the visible appearance of the previously-selected item to the normal appearance, but that can be handled be just removing the .polymer-selected style handling the deselection through code. I might want to do something when there's no selection, but that's slightly different; I don't care about which item was last selected, all I care about is that there's no longer a selection. Suppose I have a button next to a list that should be enabled only when there's a selection in the list. The way things stand with polymer-select now, the simplest way to handle that would be to disable the button whenever an item is deselected (because maybe I don't know if a new item is going to become selected), and re-enable it whenever a new item is selected. That feels kind of janky; whenever the user clicks a different item, the button gets disabled and immediately re-enabled. In that situation, I'd rather just hear about the new item that's been selected — and be told the newly-selected item is "null" if the list has completely lost its selection.
Anyway, I appreciate the complexity here. Just sharing some thoughts.
from polymer-elements.
Related Issues (20)
- No demos work in IE10 HOT 2
- can't get tests running HOT 2
- Bower packages HOT 21
- Polymer elements that represents raw data HOT 2
- localstorage and toggle-button don't play nicely HOT 5
- polymer-signals events should not bubble, but non-bubbling events are unsupported by on-* syntax
- uppercase signals do not work HOT 4
- polymer-google-jsapi doesn't fire polymer-google-jsapi-loaded in Canary HOT 1
- Error in CONTRIBUTING.md HOT 2
- polymer-flex-panel source missing. HOT 1
- <polymer-animation>: cannot play an animation in WebComponentsReady without going async HOT 1
- <polymer-animation>: change event names HOT 1
- polymer-ajax: properly serialize nested objects/arrrays HOT 4
- polymer-animation element is currently broken
- bower.json's version needs a bump HOT 1
- Rename elements.html
- polymer-element size is not adjust to content size HOT 6
- polymer-elements.html malformed
- template repeat doesn't work if not wrapped in another template HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polymer-elements.