* Fires the afterClosed callback once the dialog is removed and the previously-focused element has been refocused. Until now the order was reversed, which prevents people from being able to refocus a different element.
* Cleaned up the `MdDialogContainer` logic to simplify it and to remove the need to subscribe to zone events.
* Switches the progress spinner from using `querySelector` to `ViewChild`.
* Moves all of the remaining DOM manipulation to the renderer.
* Skips animations if `requestAnimationFrame` is not available.
* Simplifies some unnecessarily complex logic for adding/removing the theme class.
Fixes#3988.
Removes the `pointer-events: none` from the input placeholder in order to allow for users to bind events to it. Clicking through isn't necessary anyway, because it automatically redirects focus to the underlying input already.
Currently when using the `mdTextareaAutosize` directive the textarea height might be incorrect on component initialization.
This happens because the textarea `scrollHeight` property is not ready in the `ngOnInit` lifecycle hook yet.
Other libraries like `angular-elastic` have timeouts for that. But using the `ngAfterViewInit` lifecycle hook is more elegant and also ensures that the `scrollHeight` property is ready.
Also switches `offsetHeight` to `clientHeight` since we don't want to include the border in our line-height calculations.
Also by default `textarea` elements have a padding of `2px` and the `padding` needs to be explicitly set to `0px` when resolving the line-height.
Fixes#4070.
* build: detect todos in public comments
* Creates a naive rule that checks all multi-line comments and reports failures once it detects TODOs inside of it.
* This means that TODOs always need to placed inside of single-line comments.
Fixes#4026
* Introduces a version placeholder (as in angular/angular) that will be replaced with the version string form the root `package.json` file.
* This ensures that the different packages are always having the correct version and it also ensures that there is no version-mismatch.
Throws a slightly better error when the wrong prefix is used. The error now includes the node name of the offending element, which should make it easier to pinpoint the issue.
* The checkbox and radio disable the ripples using a `*ngFor` check. This causes the `ViewChildren` instance to turn null. The reference is required for the focus indicators.
* If ripples are disabled there will be still ripples on click. This is due to the fact that label elements redirect focus to the underlying input element. The `focusOrigin` is therefore `program` and a focus ripple will show up.
* Tests had to be adjusted because the `[md-ripple]` element won't be removed anymore. Therefore the tests now confirm that no ripples are showing up.
Fixes#3856.
* fix(button): ripple color for raised buttons
* Fixes the incorrect ripple color for raised buttons. Currently the ripple color is always based on black. This is incorrect on palettes like Indigo.
Fixes#2901
* Address feedback
* Distinguish between buttons with focus overlay
* Fix comment
This fixes positioning issues when rendering templates which contain embedded templates.
The templates need to be rendered in order to properly determine width which can then determine placement.
* Wraps multi-line text, instead of truncating it, inside of snack bars. **Note:** While the spec only mentions multi-line text on mobile, this seems to be a better approach than cutting it off at ~500px. We can revisit this if we start using media queries.
* Aligns the snack bar button margin to the spec.
* Simplifies some of the CSS to remove the need for a hardcoded height and negative margins.
Fixes#1951.
* fix(tooltip): wrong position when using OnPush change detection
Fixes the tooltip having a wrong position if it is inside a component with `OnPush` change detection. The issue was due to the fact that when `OnPush` is used, the tooltip text isn't rendered at the moment when the element is positioned.
Fixes#3497.
* For API docs, wrap each generated document in `.docs-api`
* For markdown docs, wrap each generated document in `.docs-markdown`
* Remove the `h1` from API docs that contained only the component name
* Change the `h2` for API docs to be a friendlier title followed by an example import.
* Increase header level for API by one across the board (so that they're "under" the new `h2`)
* A few misc. docs fixes
We've found that, with the current state of tree-shaking in the world,
that using an aggregate NgModule like `MaterialModule` leads to tools
not being able to eliminate code for components that aren't used.
In order to ensure that users end up with the smallest code size
possible, we're deprecating MaterialModule, to be removed in the a
subsequent release.
To replace `MaterialModule`, users can create their own "Material"
modul within their application (e.g., `GmailMaterialModule`) that
imports only the set of components actually used in the application.
* test(select): various test inconsistencies
* Fixes a select test that occasionally fails to capture the error inside the expect, causing it to get logged without actually being thrown. This seems to be a Zone-related issue since wrapping a few calls in `async` makes it behave correctly.
* Fixes an RTL test that fails if it is made async. This incorporates the changes from #3866 and #3163 and fixes the underlying issue. It appears that the test was failing, because IE does a slight twitch on the select panel since it goes from a pixel-based `min-width` to one with `calc` and percentages to just percentages. I've set the default width to 100% which is the same as the pixel-based one, which appears to make IE happy.
* chore: verify that changing the min-width causes failures
* chore: revert min-width change
* chore: remove a few unnecessary expressions
* fix: aot runtime issues
Currently when using the `MdSnackBar` in AOT, there will be runtime exceptions from the NgFactory. Those are caused by the re-exports of DI tokens.
The Angular compiler will then look for the first export e.g `MdLiveAnnouncer` and the normal `LiveAnnouncer` export wont be included in the factory.
This is breaking at runtime now, because the NgFactory searches for `LiveAnnouncer` but there is only the `LiveAnnouncer` (DI exception)
Since this deprecation is pretty old we can safely remove it anyways. Although this is probably an Angular that should be reported separately.
Also this commit fixes the output directory of the `aot` gulp task. Currently it outputs the factories in a wrong directory. (This allows us to serve the aot demo-app in the future)
* Remove MdUniqueSelectionDispatcher
Fixes the slide-toggle required demo, where the component will be compared with the native required state.
Basically in the demo, the form should be validated native and should show the browsers popup if the slide-toggle is required.
* Renames the `unmonitor` function to `stopMonitoring`.
* Removes unnecessary code that keeps track of the `FocusOriginMonitor` subscription. After calling `stopMonitoring` the observable will complete.
* feat(dialog): allow for the dialog dimensions to be updated
Adds an `updateDimensions` method to the `MdDialogRef` which allows the user to update a dialog's dimensions after it has been created.
Fixes#2930.
* refactor: split dimensions method into two
* refactor: rename updateDimensions to updateSize
* refactor: add back _getOverlayState method
* chore: fix aot issue
Fixes an error that is thrown if something attempts to access the `selected` value of `md-select` too early. The issue comes from the fact that the underlying `SelectionModel` gets initialized too late in `ngAfterContentInit`.
Fixes#3750.
* feat(theming): log a warning if core theme isn't loaded
* Checks the user's loaded stylesheets and logs a warning if the Material core theme isn't loaded.
* Fixes a wrong `typeof` check when determining the doctype.
Fixes#2828.
Note: I originally went with looping through the `document.styleSheets` to check whether the selector is defined, however I had to switch back to `getComputedStyle`, because browsers don't expose the `document.styleSheets`, if the CSS file is being loaded from another domain. This would've caused the warning to be logged if the user loads over a CDN.
* refactor: address feedback
* fix(autocomplete): do not trigger submit on ENTER
When an option is selected with the ENTER key, it should not submit the form and prevent the default input behavior
Fixes#3159
* test(autocomplete): removing extra detectChanges
* fix(dialog): leaking MdDialogContainer references
Fixes an issue that caused the `MdDialogContainer` references to not be cleaned up, and as a result, any of the `MdDialogRef` and `MdDialogConfig` instances as well. The issue seems to come from the fact that a couple of blocks that look like:
```
this._ngZone.onMicrotaskEmpty.first().subscribe(() => {
this._elementFocusedBeforeDialogWasOpened = document.activeElement;
this._focusTrap.focusFirstTabbableElement();
});
```
End up being transpiled to:
```
var _this = this;
this._ngZone.onMicrotaskEmpty.first().subscribe(function () {
_this._elementFocusedBeforeDialogWasOpened = document.activeElement;
_this._focusTrap.focusFirstTabbableElement();
});
```
This seems to cause the browser to retain the `_this` reference after the dialog has been destroyed.
Fixes#2876.
* chore: add comment about `this` usage in zone