-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(datepicker): make touch UI work well on mobile #3853
Conversation
$md-datepicker-non-touch-calendar-width: | ||
$md-datepicker-non-touch-calendar-cell-size * 7 + $md-datepicker-calendar-padding * 2; | ||
|
||
// Note(mmalerba): Ideally the calendar would have a constant aspect ratio, no matter its size, |
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.
You can omit Note(mmalerba)
since it's just an explanatory comment
src/lib/datepicker/datepicker.ts
Outdated
@@ -49,6 +49,11 @@ let datepickerUid = 0; | |||
selector: 'md-datepicker-content', | |||
templateUrl: 'datepicker-content.html', | |||
styleUrls: ['datepicker-content.css'], | |||
host: { | |||
'[class.mat-datepicker-content]': 'true', |
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.
You should be able to just do
host: {
'class': 'mat-datepicker-content'
}
And Angular will union it with the other classes and not overwrite (so long as it isn't a '[class']
binding)
src/lib/datepicker/datepicker.ts
Outdated
host: { | ||
'[class.mat-datepicker-content]': 'true', | ||
'[class.mat-datepicker-content-touch]': 'datepicker.touchUi', | ||
'[class.mat-datepicker-content-non-touch]': '!datepicker.touchUi', |
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.
Why have two classes instead of a style without the -touch
class and then another with (where the latter would inherently be higher specificity)?
src/lib/dialog/dialog-container.ts
Outdated
@@ -48,13 +48,25 @@ export type MdDialogContainerAnimationState = 'void' | 'enter' | 'exit' | 'exit- | |||
]) | |||
], | |||
host: { | |||
'[class]': 'dialogConfigClasses', |
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.
This will overwrite all other classes on the dialog-container element
src/lib/dialog/dialog-config.ts
Outdated
@@ -32,6 +32,9 @@ export class MdDialogConfig { | |||
/** Position overrides. */ | |||
position?: DialogPosition; | |||
|
|||
/** Classes to add to the dialog container. */ | |||
containerClass?: string | string[] = ''; |
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.
Do you need a class on the dialog container or on the root overlay element? I'd prefer to do the latter if we have to do this at all, as the dialog-container is meant to be a internal implementation detail
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'll undo this since we plan to move away from using dialog, I can hack around it for now
src/lib/dialog/dialog-container.ts
Outdated
'[class.mat-dialog-container]': 'true', | ||
'[attr.role]': 'dialogConfig?.role', | ||
'[@slideDialog]': '_state', | ||
'(@slideDialog.done)': '_onAnimationDone($event)', | ||
}, | ||
}) | ||
export class MdDialogContainer extends BasePortalHost implements OnDestroy { | ||
/** The CSS classes for the container specified in the dialog config. */ | ||
get dialogConfigClasses(): string { |
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.
This behavior would need unit tests if kept
comments addressed |
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.
LGTM
* add keyboard support, break some tests * add tests * some finishing touches * addressed some comments * separate md-datepicker-content into own component * fix(datepicker): make touch UI work well on mobile * use vmin instead of media queries + vw, vh * fix non-touch styles * addressed comments * fix lint error about vmin * addressed comments
* add keyboard support, break some tests * add tests * some finishing touches * addressed some comments * separate md-datepicker-content into own component * fix(datepicker): make touch UI work well on mobile * use vmin instead of media queries + vw, vh * fix non-touch styles * addressed comments * fix lint error about vmin * addressed comments
* add keyboard support, break some tests * add tests * some finishing touches * addressed some comments * separate md-datepicker-content into own component * fix(datepicker): make touch UI work well on mobile * use vmin instead of media queries + vw, vh * fix non-touch styles * addressed comments * fix lint error about vmin * addressed comments
* add keyboard support, break some tests * add tests * some finishing touches * addressed some comments * separate md-datepicker-content into own component * fix(datepicker): make touch UI work well on mobile * use vmin instead of media queries + vw, vh * fix non-touch styles * addressed comments * fix lint error about vmin * addressed comments
* add keyboard support, break some tests * add tests * some finishing touches * addressed some comments * separate md-datepicker-content into own component * fix(datepicker): make touch UI work well on mobile * use vmin instead of media queries + vw, vh * fix non-touch styles * addressed comments * fix lint error about vmin * addressed comments
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. |
depends on #3839