-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(select): basic selection and animations #1647
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
Conversation
e145dc3
to
e3c0af6
Compare
'role': 'option', | ||
'[class.md-selected]': 'selected', | ||
'[attr.aria-selected]': 'selected.toString()', | ||
'[attr.tabindex]': '0', |
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.
Can you set tabIndex without it being a binding?
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.
Yes, but I'll need to bind it again as soon as I add disabled support (in the next PR probably)
} | ||
|
||
/** | ||
* The displayed value of the option. |
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.
I'd expand this comment to mention something like
"Used to show the selected value in the select's trigger.
} | ||
|
||
/** Unselects the option. */ | ||
unselect() { |
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.
deselect
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.
Thank you! I knew it sounded wrong!
'[attr.aria-selected]': 'selected.toString()', | ||
'[attr.tabindex]': '0', | ||
'(click)': 'select()', | ||
'(keydown)': '_selectOnActivate($event)' |
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.
Just _handleKeydown
? (ince this is specially handling keyboard input)
trigger, | ||
} from '@angular/core'; | ||
|
||
export class SelectAnimations { |
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.
Add class/method descriptions. Include a high-level explanation of what the animations do. Also mention where the values come from (lots of magic values in here).
* TODO: internal | ||
*/ | ||
_getPanelState(): string { | ||
return this._isRtl() ? 'in-rtl' : 'in'; |
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.
in-rtl
and in
?
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.
maybe in-rtl
and in-ltr
? or showing-rtl
and showing-ltr
?
|
||
/** | ||
* Ensures the option is selected when activated from the keyboard. | ||
* TODO: internal |
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.
Let's stop adding new instances of TODO: internal
. At this point we're mostly settled into the convention of underscore without private
as meaning internal.
(we can remove the old ones in a cleanup pass)
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.
Okay, that's fair. Will do.
Renderer, | ||
ViewEncapsulation | ||
} from '@angular/core'; | ||
import {ENTER, SPACE} from '../core/keyboard/keycodes'; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'md-option', |
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.
Add md-option
to style-compatibility.ts
template: ` | ||
<ng-content></ng-content> | ||
<div class="md-option-ripple" md-ripple md-ripple-background-color="rgba(0,0,0,0)" | ||
[md-ripple-trigger]="_getHostElement()"></div> |
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.
I think this is long enough for its own file.
return this.trigger.nativeElement.getBoundingClientRect().width; | ||
} | ||
|
||
/** The animation state of the placeholder. |
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.
Unit tests for animation states?
@jelbourn Comments should be addressed |
@kara: This broke a bunch of targets in Google with the following error:
|
@hansl Should be fixed |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This is the first PR of several to get the select component up and running. It only adds basic selection and animations. More coming.
r: @jelbourn