-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Remove [de]registerEventHandler methods from adapters #2813
Comments
You say "expose information" which I assume means documentation... but I assume we also need to move any existing registrations out of the foundation and into our vanilla components, right? |
That's correct |
Tracking this as one issue for now, but we will undoubtedly want to PR this one package at a time. IIRC a couple of packages may also dynamically add and remove event handlers (e.g. menu I think?). I'm not sure if we can move registration out of the foundation in those cases? |
Hi, is adapter and foundation the same thing? And can you give me a sample code on integrating MDC with React using adapter/foundation? |
Foundation, adapter, and component are briefly described here: https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md#javascript We have a codelab that walks through wrapping a component for React: https://codelabs.developers.google.com/codelabs/mdc-112-web/index.html |
### Issues fixed * Fixes #4005 (via new `mdc-snackbar-viewport-margin()` mixin) * Fixes #3981 * Fixes #2916 (via new `MDCSnackbar:closing` and `MDCSnackbar:closed` events) * Fixes #2628 * Fixes #1466 (via new `close()` method) * Fixes #1398 * Fixes #1258 * Fixes #11 (the label now expands indefinitely to fit the text) * Refs #2813 ### Screenshots ![Baseline without action button](https://user-images.githubusercontent.com/409245/49956261-a080ca80-feb9-11e8-8287-b7e805344115.png) ![Baseline with action button](https://user-images.githubusercontent.com/409245/49956109-4a138c00-feb9-11e8-9213-3241fa86a1b8.png) ![Stacked layout](https://user-images.githubusercontent.com/409245/49956173-6a434b00-feb9-11e8-8a03-2e58ccc8f763.png) BREAKING CHANGE: Snackbar's DOM and APIs have changed to match the latest design guidelines. See the Snackbar documentation for more information.
@abhiomkar I'm going to fix this for top app bar to fix #4527. |
Our adapters often have
registerEventHandler
/deregisterEventHandler
methods that are used to add and remove event listeners from DOM nodes. Many frameworks (React, Angular, Vue, etc) prefer events to be bound directly on the DOM elements. This has the benefit of not requiring references to the DOM in the component lifecycle and ensuring that the event handlers are appropriately cleaned up on component destruction.For many of those frameworks, the
registerEventHandler
/deregisterEventHandler
adapter methods become no-ops.We should remove the
registerEventHandler
/deregisterEventHandler
methods from our adapters and instead expose information about which handlers should be bound to which events. Registering the event handlers will then become the responsibility of those who wrap our components.Packages that may require updates, as of 5/29/18:
The text was updated successfully, but these errors were encountered: