material icon indicating copy to clipboard operation
material copied to clipboard

mdSelect: Add select component

Open ajoslin opened this issue 12 years ago • 105 comments

The mdSelect is a type of Material Design Menu that behaves like and resembles a <select>.

Menu behavior

Functional requirements

- Menu should be positioned over their "emitting" elements, establishing context - The selected menu item should not be shown as a duplicate when expanded - Dismiss menu by selecting an item (unless selecting multiple), tapping outside the menu, or using the Escape key - Menu animates out from emitting item when expanding

Accessibility requirements

- **mdSelect element** - `[aria-live="polite"]` makes sure selections are announced in a screen reader. Copy list item text to button only when selection is made with enter/space key, or click (not arrow keys). That way it won't read aloud twice. - **Button element** - `[aria-haspopup="true"]` indicates button launches associated input - `[aria-controls="_listID_"]` links button to options list - Needs unique ID for pairing with list - **Unordered list** - [`role="menu"`](http://www.w3.org/TR/wai-aria/roles#menu) to communicate purpose of list - `aria-labelledby="_buttonID_"` to pair with button element - `aria-expanded="true | false"` to indicate when associated panel is expanded - Unique ID for pairing with button - `tabindex="-1"`to script focus but remove from tab order - **Child list items** - [`role="menuitem"`](http://www.w3.org/TR/wai-aria/roles#menuitem) on each child item - `tabIndex="-1"` for scripting

Resources

- [WAI-ARIA Listbox](http://www.w3.org/TR/wai-aria/roles#listbox) - [Using "listbox" and "option" roles vs. "menu" and "menuitem"](http://www.marcozehe.de/2014/03/11/easy-aria-tip-7-use-listbox-and-option-roles-when-constructing-autocomplete-lists/)

ajoslin avatar Sep 17 '14 13:09 ajoslin

Thank you @yarl. I do agree with @seiyria that it is much better than default styling.

Given all the silly +1 stuff, I am sure they are looking at. I see one member asked about multi-select which I would like as well. I like the way chosen/select2 place the selected items in a box that the use can remove with a click of the "X". This is also similar to addresses on emails in gmail or outlook.

Another capability to consider is a clear button on the input. This can be done easily enough as a separate button to trigger it, but and individual clear can be a nice feature.

jadrake75 avatar Jan 12 '15 16:01 jadrake75

@jadrake75 From what I understand, the angular-material team aims to implement the official Material spec (see here and there). What you are describing will be implemented: the name of the feature you're interested in is chips, due for 0.9 - see #1045 image

PaulMougel avatar Jan 12 '15 20:01 PaulMougel

+1

m4cx avatar Jan 15 '15 15:01 m4cx

Here's a preview of progress.

What's done:

  • Select databinding (multiple and single)
  • Proper animations with edge of screen cases. Always keeps 16px away from the edge, fitting the select on screen the best it can, according to spec.
  • Opening and closing programatically via service

http://ajoslin.co/17cMg

What's left:

  • Creating a button for the normal case where developer puts a select in their markup.
  • Some polish
  • a11y

ajoslin avatar Jan 24 '15 23:01 ajoslin

Looks very nice so far! I'm very excited to try this out!

seiyria avatar Jan 24 '15 23:01 seiyria

Good work :)

luclanet avatar Jan 24 '15 23:01 luclanet

Awesome! This would be a long awaited child. Wish there was a countdown on the Angular materials website for each of the new components. :)

demisx avatar Jan 24 '15 23:01 demisx

@ajoslin - noice!

ThomasBurleson avatar Jan 25 '15 00:01 ThomasBurleson

Awesome job! Cant wait for the release! Big thanks @ajoslin

imjerryyang avatar Jan 25 '15 04:01 imjerryyang

awesome work @ajoslin

i hope this lands before the end of January

utopiaio avatar Jan 25 '15 04:01 utopiaio

Cool!

fundon avatar Jan 25 '15 06:01 fundon

Looks great!

ilianaza avatar Jan 26 '15 23:01 ilianaza

@ajoslin @ThomasBurleson just a suggestion, but I think you guys should start releasing 0.8.0-rc with incremental releases after some new significant development every so often in the specific release. As it is, most users are testing Material out, so most people quickly update to the latest version. This would allow people to start playing around with mdSelect and any other already-fixed issues so that people can provide feedback. This way, 0.8.0 could be almost perfect and as free of little bugs as possible.

ilanbiala avatar Jan 26 '15 23:01 ilanbiala

+1 Eagerly waiting for this component. I also need a md-date and/or md-datetime component!

JoeyHoutenbos avatar Jan 29 '15 09:01 JoeyHoutenbos

@JoeyHoutenbos about the date pickers, #648 had an extensive discussion about them

gustavohenke avatar Jan 29 '15 10:01 gustavohenke

@ajoslin I have used md-select from your branch "wip-select-2" and it works well on first time but it is not working when i clicked second time on the select area. can you provide some solution for that ?

sunny9240 avatar Jan 30 '15 07:01 sunny9240

I would wait until it's considered done before trying to report issues against it. On Jan 30, 2015 1:48 AM, "Sunny Shah" [email protected] wrote:

@ajoslin https://github.com/ajoslin I have used md-select from your branch "wip-select-2" and it works well on first time but it is not working when i clicked second time on the select area. can you provide some solution for that ?

— Reply to this email directly or view it on GitHub https://github.com/angular/material/issues/276#issuecomment-72165606.

seiyria avatar Jan 30 '15 13:01 seiyria

@sunnyshah01 the select is still a work-in-progress, hence the branch name including "wip". @ajoslin is still working on it but it should be ready soon. Until then, it doesn't make much sense to provide solutions for an API that is still in active development.

marcysutton avatar Jan 30 '15 21:01 marcysutton

@sunnyshah01 try the latest push.

I know of most of the current problems / missing features ... but if you find any that I miss, that makes me happy.

ajoslin avatar Jan 31 '15 19:01 ajoslin

@marcysutton so ... accessibility questions.

When there's an input element that opens up a select menu underneath it, I don't ever move focus away from the input element. This is good for the user's keyboard, but what's the best way to get a screenreader to announce the available choices in this case?

ajoslin avatar Jan 31 '15 21:01 ajoslin