-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(select): update the trigger width and overlay state when select is opened #6489
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
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.
Thanks for the second PR!
src/lib/select/select.ts
Outdated
/** | ||
* Always set the trigger width since we need to | ||
* update the panel with its new minWidth when opening it | ||
*/ |
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.
Nit: For comments inside methods, we typically use //
comment style. Applies throughout PR.
@@ -340,6 +345,8 @@ export class ConnectedOverlayDirective implements OnDestroy, OnChanges { | |||
this._position.withDirection(this.dir); | |||
this._overlayRef.getState().direction = this.dir; | |||
this._initEscapeListener(); | |||
/** Update the overlay size, in case the directive's inputs have changed */ | |||
this._configureSize(this._overlayRef.getState()); |
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.
The getState()
method isn't really meant to be used to set state. @jelbourn and I discussed and we think there should be a dedicated method in OverlayRef
to set the size props in the state. There is already an updateSize
method, but it's really an internal implementation. So let's:
- rename the existing
updateSize
to_setSizeStyles
- add a new
updateSize
method that simply updates the size props in the state
Then you can use the new updateSize
to set the props here, instead of getState()
.
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.
Cool, will do that 😄
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.
Ping me when it's ready! :)
b966ef7
to
311242a
Compare
@kara i updated it based on the comments I wasnt sure if i needed to create a specific interface for the state sizes, but i opted for reusing the Let me know if i need to change anything else or if i misunderstood anything. 😄 |
I dont know why the unit test failed for |
@emoralesb05 Don't worry about that test; it's a flake (should be fixed by #6514). |
@kara Cool, was all confused about it haha 😄 |
* No longer creates the coverage reports inside of Browserstack. The reports can be generated inside of Chrome Headless that doesn't run remotely on BrowserStack or Saucelabs.
Fixes a few e2e tests that were failing due to subpixel measurement differences.
Due to angular/dgeni-packages#246 the Material docs package used a workaround for accessor types. The issue has been fixed with angular/dgeni-packages#247 and the workaround can be removed now.
Adds a generic parameter to the `MatDialogConfig` that indicates the type of its `data`. BREAKING CHANGE: Material now requires at least TypeScript 2.4. Fixes angular#4398.
The demo app won't build due to PR angular#7630.
Fixes a few obscure test failures on iOS Safari.
…gular#7807) * Currently the select sets the `multiple` and `disableRipple` values on its options manually. In order to avoid "changed after checked" errors we wrap the calls in promises, however this also forces us to have `async` tests which can time out if the browser is out of focus. These changes add a provider that allows for the options to take the value directly from the select. * Refactors some unit tests that have been timing out in Firefox to run in the `fakeAsync` zone instead of the `async` one.
Adds the `gulp test:static` task that is identical to `gulp test`, however it doesn't launch Chrome automatically, which is convenient for debugging any browser that isn't Chrome. Currently the debugging flow for other browsers is running the Gulp task which launches Chrome, waiting for it to finish running the tests, connect the other browser, wait for the new browser to finish and then start debugging. With the new task you can just run the Gulp task and connect and disconnect only the relevant browsers.
Fixes a typo in the directory name of one of the examples.
No longer hides the focus indicator ripple on click/space. Right now if a keyboard user tabs to the checkbox and presses SPACE to toggle the checkbox, the focus indicator ripple disappears. This makes it hard to see what element is focused or not. For comparison, native checkboxes also keep the focus effect on keyboard press. Also Polymer follows the same convention with the focus indicator.
Sure, let me try doing it today @crisbeto 😄 |
* Adds support for the `opened` input binding. Closes angular#8094
…ngular#8269) Fixes updates to a spinner's value not being saved if they happen while the component is indeterminate, causing it to be wrong if it becomes determinate again.
angular#8270) Fixes the slide label component collapsing down to 16px if it doesn't have a label. Fixes angular#8264.
…gular#8514) Fixes blurry ripples in the slide-toggle, radio and checkbox in Microsoft Edge. The ripples have been blurry because the `border-radius` in an absolute position seems to cause render problems for Edge. Since the ripples are circular by default, the `border-radius` can be removed and the ripple radius just needs to be set to the value that has been set through CSS before this change. This fixes the blurry ripples in MS Edge and might also improve rendering-stability of the ripples. Fixes angular#8392
* demo(list): Add accessibility demo page for list * fix test * set default role for md-list * fix test * Add template file for list
…gular#8674) Gets rid of all the manual stubs of the `OverlayContainer` in the tests and replaces them with getting the container through DI. This removes some boilerplate and should make things less prone to breaking if we make any changes to the container.
* Adds the material-experimental package.
…on (angular#8099) * Prevents datepickers that are in a fallback position from overlapping their input by adding an offset. * Fixes some inconsistent brace spacing.
…#7857) Currently, when the text of an option is truncated, it ends up removing everything except the ellipsis on Firefox, IE and Edge. These changes fix the truncation and simplify the option view. Relates to angular#7211.
Im going to close this PR and opened a new one.. i think i screwed up the rebase somehow haha.. im not really good at it lol Also, turns out the changes needed are minimal.. so i rather do a diff PR and start over again |
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. |
when changing the width of the md-select (e.g. using flex box) after its rendered, the template[cdk-connected-overlay] does not update its minWidth and keeps the initial minWidth every time its opened.
This issue partially happens because the cdk-connected-overlay sets the width, minWidth, etc etc only once and never updates it again.
Here is a plnkr to demonstrate the issue: http://plnkr.co/edit/ERg71p?p=preview
Proposed fix in PR
We just need to set the new _triggerWidth every time the md-select is opened (open()) and update the overlayRef#OverlayState in ConnectedOverlayDirective when the template is attached.
New PR to replace what was stated in #3623