Title: Input change event bubbling into custom component change event · Issue #13997 · angular/angular · GitHub
Open Graph Title: Input change event bubbling into custom component change event · Issue #13997 · angular/angular
X Title: Input change event bubbling into custom component change event · Issue #13997 · angular/angular
Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request here, instead see https://github.com/an...
Open Graph Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request...
X Description: I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not su...
Opengraph URL: https://github.com/angular/angular/issues/13997
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Input change event bubbling into custom component change event","articleBody":"**I'm submitting a ...** (check one with \"x\")\r\n```\r\n[x] bug report =\u003e search github for a similar issue or PR before submitting\r\n[ ] feature request\r\n[ ] support request =\u003e Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\nA custom component exposes an event named `change`: `@Output() change = new EventEmitter\u003cMyEventArg\u003e(true);`. Component contains a (reactive) form, which in turn holds an `\u003cinput\u003e` node whose `(change)` event is not bound to any handler.\r\nWhen input loses its focus, e.g. after user types in then tabs or clicks away, the **custom component** `change` event is fired, receiving a JS `Event` object as passed argument, totally unrelated to `MyEventArg` type. It seems like the inner input change event, while bubbling up, gets caught and handled by custom component change event.\r\n\r\n**Expected behavior**\r\nWhen input loses its focus, the input change event should not be caught by custom component. So custom change event should **not** fire unexpectedly, with unwanted arguments.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\nSee plunk at https://plnkr.co/edit/M8KSb62Tqh7bT01PTYJ3?p=preview.\r\nAnyway, it is enough to:\r\n\r\n1. define a custom component wrapping an input, \r\n1. define a `change` output event on custom component, \r\n1. bind custom component change event to some external handler\r\n1. then type into input and let input lose focus.\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\nI'd like to be able to name the change event on a custom component as `change`, and not something else like `changed` or `myComponentChange`. By the way, that *change* name is also used in the official angular tutorial on custom component.\r\n\r\n**Please tell us about your environment:**\r\nIt should not matter at all, just in case: Win 10 64bit, npm 3.9.5\r\n\r\n* **Angular version:** 2.4.2\r\n\r\n* **Browser:** Tried on Chrome 55.0.2883.87 m\r\n \r\n* **Language:** TypeScript 2.0.6\r\n\r\n* ~**Node (for AoT issues):** `node --version` =~\r\n\r\nI tried searching on the web for any \"reserved\" event names, but instead I found an official doc page using that name for a custom component. I tried searching among the issues for anything similar, but it was not easy to refine search with terms like \"change\" and \"event\", but on first result pages could not find anything.","author":{"url":"https://github.com/GiuseppePiscopo","@type":"Person","name":"GiuseppePiscopo"},"datePublished":"2017-01-18T21:43:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/13997/angular/issues/13997"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:76a4cf9b-8228-8e29-1313-9e09afc4ec0d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E4A6:1E7BC5:AB1DA:E5D70:6A612C7C |
| html-safe-nonce | 741e6af416238389ee5c28101d9dd4945540e114d01031daeac288b1b25c0383 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEE2OjFFN0JDNTpBQjFEQTpFNUQ3MDo2QTYxMkM3QyIsInZpc2l0b3JfaWQiOiI2Mjg5MjQ3OTExODUzMjM5NDIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5dfd5867ba6a0405e32f8df02cef31ace7624b3c12f0a1aa971485d3f0757a26 |
| hovercard-subject-tag | issue:201700585 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/13997/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d49d65cbf5a5e6dc2e3d38c9ab0edcb4ed0bd6c3f3f6a0c0c9d4627cfc5cacaf/angular/angular/issues/13997 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d49d65cbf5a5e6dc2e3d38c9ab0edcb4ed0bd6c3f3f6a0c0c9d4627cfc5cacaf/angular/angular/issues/13997 |
| og:image:alt | I'm submitting a ... (check one with "x") [x] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | GiuseppePiscopo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6896275b704df9b9258326d49c8695aecd98d736cd9eeda7bcbb1790ac97d3ad |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | af89f6cd55841b57fa09b6b0ed9e3f8f2e94b05d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width