Skip to content
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

checkbox id attribute cannot be set to null and be ignored #5394

Closed
eginwong opened this issue Jun 28, 2017 · 3 comments · Fixed by #5398
Closed

checkbox id attribute cannot be set to null and be ignored #5394

eginwong opened this issue Jun 28, 2017 · 3 comments · Fixed by #5398
Assignees

Comments

@eginwong
Copy link

eginwong commented Jun 28, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

I'm trying to build a wrapper around the angular material library because there are certain customizations/enhancements that we want to add on top. When writing the wrapper, we pass inputs from the wrapper component to the angular material element. In this case, mdCheckbox.

When we don't set the value for "id" for our wrapper for mdCheckbox, it sets the <input> value for id to "input-". This is inconsistent as we don't set the value for "id" for our wrapper for mdSlideToggle and the <input> value for id is a unique value. Expected behaviour is that the <input> id value for mdCheckbox should be a unique, just like the implementation of mdSlideToggle.

What is the current behavior?

getting <input id="input-"> but should be unique like "<input id="input-checkbox-#">" or something along those lines.

What are the steps to reproduce?

http://plnkr.co/edit/2cvLOW?p=preview

What is the use-case or motivation for changing an existing behavior?

Inconsistency, hard to wrap components and expose inputs

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Using:

Angular 4.0.0, Material 2.0.0-beta.7, MACOSX, TypeScript 2.3.3

probably all browsers

Is there anything else we should know?

First time submitting bug report, please let me know if I'm missing anything for next time. Thanks!

@willshowell
Copy link
Contributor

As a heads up, I expect you want to be binding to the inputs, not passing them as strings.. See the updated plunker

http://plnkr.co/edit/gUFRYa?p=preview

Regardless, you're right:

slide-toggle

get inputId(): string { return `${this.id || this._uniqueId}-input`; }

checkbox

get inputId(): string { return `input-${this.id}`; }

@devversion
Copy link
Member

Yeah consistency makes sense here. I'm working on a PR that uses TypeScript mixins for the id generation.

This should ensure that we have everywhere the same id format and we don't have to repeat code multiple times.

@devversion devversion self-assigned this Jun 28, 2017
devversion added a commit to devversion/material2 that referenced this issue Jun 28, 2017
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If id's are auto-generated they should be reflected in the `id` property of the component (after setting the id to `null` for example)
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes angular#5394
devversion added a commit to devversion/material2 that referenced this issue Jun 28, 2017
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If id's are auto-generated they should be reflected in the `id` property of the component (after setting the id to `null` for example)
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes angular#5394
devversion added a commit to devversion/material2 that referenced this issue Jun 29, 2017
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes angular#5394
devversion added a commit to devversion/material2 that referenced this issue Jul 1, 2017
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes angular#5394
devversion added a commit to devversion/material2 that referenced this issue Jul 8, 2017
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes angular#5394
jelbourn pushed a commit that referenced this issue Jul 10, 2017
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes #5394
jelbourn pushed a commit that referenced this issue Jul 11, 2017
* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes #5394
jelbourn pushed a commit that referenced this issue Jul 11, 2017
…5398)

* In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
* If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

Fixes #5394
amcdnl added a commit to amcdnl/material2 that referenced this issue Jul 12, 2017
commit da1d1ca
Author: mmalerba <mmalerba@google.com>
Date:   Tue Jul 11 10:19:41 2017 -0700

    fix(datepicker): use 3 rows to display months of year (consistent with internal mocks) (angular#5427)

    fixes angular#5202

commit ed2ece9
Author: Kristiyan Kostadinov <crisbeto@users.noreply.github.com>
Date:   Tue Jul 11 19:18:41 2017 +0200

    chore(tabs): switch to OnPush change detection (angular#5631)

    Switches all of the tab-related components to OnPush change detection and sorts out the issues that come from the changes.

    Relates to angular#5035.

commit 70117ff
Author: Kristiyan Kostadinov <crisbeto@users.noreply.github.com>
Date:   Tue Jul 11 19:16:00 2017 +0200

    chore(selection): switch option and pseudo checkbox to OnPush change detection (angular#5585)

    * Switches the MdPseudoCheckbox, MdOption and MdOptgroup to OnPush change detection.
    * Fixes a few cases in MdOption where the UI state wasn't being updated properly.

    Relates to angular#5035.

commit bcf4826
Author: Paul Gschwendtner <paulgschwendtner@gmail.com>
Date:   Tue Jul 11 19:09:02 2017 +0200

    fix(checkbox, radio): setting id to null causes invalid id for input (angular#5398)

    * In some situations, developers will change the `id` of a component dynamically. At some point if they set the `[id]` to `null` the input id will look like the following: `null-input`.
    * If developers are setting the `id` using a binding then the DOM Id for the host component won't be set at all (because the @input is triggered instead of the DOM property)

    Fixes angular#5394

commit 738b6be
Author: Amit Portnoy <amit.portnoy@gmail.com>
Date:   Tue Jul 11 20:02:55 2017 +0300

    fix(tabs): add module dependency on MdCommonModule (angular#5304)

    MdTabsModule **implicitly** depended on MdCommonModule
    Specifically, for rtl animations. see http://plnkr.co/edit/fBLGThvy7C0G666p56xn?p=preview.

commit f3f9f43
Author: Paul Gschwendtner <paulgschwendtner@gmail.com>
Date:   Tue Jul 11 18:56:51 2017 +0200

    tests(slide-toggle): separate form tests for slide-toggle (angular#5629)

    * Separates the tests with and without the form modules. This is important to ensure that the slide-toggle works properly without and with forms.

commit baba6ef
Author: Kristiyan Kostadinov <crisbeto@users.noreply.github.com>
Date:   Tue Jul 11 18:30:40 2017 +0200

    feat(snack-bar): inject data and MdSnackBarRef into custom snack-bar component (angular#5383)

    * feat(snack-bar): inject data and MdSnackBarRef into custom snack-bar component

    * Injects the `MdSnackBarRef` into custom snack bar instances.
    * Adds the option to inject arbitrary data into a snack bar.
    * Turns the `DialogInjector` into a `PortalInjector` to allow it to be used elsewhere (e.g. the snack-bar).
    * Minor tweaks to the `SimpleSnackBar` to get it to use the new DI tokens instead of assigning data directly to the component instance.

    Fixes angular#5371.

commit 8c13325
Author: Jeremy Elbourn <jelbourn@gmail.com>
Date:   Tue Jul 11 09:25:54 2017 -0700

    fix(bidi): make `dir` and `changes` readonly (angular#5645)

commit 72148c0
Author: Kristiyan Kostadinov <crisbeto@users.noreply.github.com>
Date:   Tue Jul 11 18:24:05 2017 +0200

    feat(typography): allow typography config to be passed via mat-core (angular#5625)

    Allows for the typography config to be specified optionally through the `mat-core` mixin, avoiding some of the extra bloat that comes from overriding the typography after a theme is defined.

    Fixes angular#5589.

commit 5bc97ec
Author: Kristiyan Kostadinov <crisbeto@users.noreply.github.com>
Date:   Tue Jul 11 18:21:55 2017 +0200

    fix(list): subheader margin being overwritten by typography (angular#5652)

    Fixes the `.mat-subheader` margin being overwritten by the `.mat-typography` due to lower specificity.

    Fixes angular#5639.

commit 9022a7a
Author: Rafael Santana <rafaelsantana3095@gmail.com>
Date:   Tue Jul 11 13:19:34 2017 -0300

    fix(pseudo-checkbox): fix spell check (pallete -> palette) (angular#5661)

commit 2295877
Author: Michael Prentice <splaktar@gmail.com>
Date:   Mon Jul 10 19:43:42 2017 -0400

    chore(examples): missing table module exports (angular#5663)

    material.angular.io build was throwing missing module errors
    `CdkTableModule` and `MdTableModule` need to be exported

    Relates to angular#5608

commit 4f8f6bd
Author: Jeremy Elbourn <jelbourn@google.com>
Date:   Mon Jul 10 12:48:10 2017 -0700

    chore: use existing screenshot firebase key

commit a1a7dcb
Author: Paul Gschwendtner <paulgschwendtner@gmail.com>
Date:   Sat Jun 10 11:16:03 2017 +0200

    build: fix deploying of screenshot functions

    * Updates the dashboard and screenshot deploy script to exit the process immediately if the Firebase token is not set.
    * Fixes that the error message of the dashboard still shows the old name of the token variable
    * Renames the screenshot variables to follow the dashboard environment variables
    * Explicitly specifies the project that will be uploaded in the screenshot deploy script (same as for dashboard)

commit 5e961cb
Author: robindijkhof <tardijkhof@gmail.com>
Date:   Tue Jul 11 00:24:26 2017 +0200

    test(sidenav): add e2e tests (angular#5463)

commit 46d0b6f
Author: Will Howell <will.s.howell@gmail.com>
Date:   Mon Jul 10 15:18:47 2017 -0400

    docs(dialog): example of how to inject MdDialogRef (angular#5311)

commit 1f97945
Author: Paul Gschwendtner <paulgschwendtner@gmail.com>
Date:   Mon Jul 10 20:38:45 2017 +0200

    build: fix stylelint deprecation warning (angular#5618)

    * Fixes the stylelint deprecation warning
    * Fixes that stylelint lints the compiled bundles from `dist/` folders of the `dashboard` or `screenshot` app
    * Updates the package-lock with NPM@5.1

commit dabcd53
Author: Paul Gschwendtner <paulgschwendtner@gmail.com>
Date:   Mon Jul 10 20:38:09 2017 +0200

    build: separate deploy jobs in deploy build stage (angular#5621)

    Currently every deployment runs in a single Travis job concurrently. This messes up the logs and it's also hard to see what actually runs at all.

    The different deployment jobs should run concurrently in the deploy build stage.

commit 145ca8e
Author: Paul Gschwendtner <paulgschwendtner@gmail.com>
Date:   Mon Jul 10 20:37:41 2017 +0200

    docs(getting-started): include cdk in systemjs config (angular#5626)

    * The getting started guide includes a brief section for the SystemJS configuration of a project using Angular Material. This extra section now also needs to include the CDK package.

    Fixes angular#5624

commit 557b31b
Author: Kristiyan Kostadinov <crisbeto@users.noreply.github.com>
Date:   Mon Jul 10 19:04:25 2017 +0200

    chore: fix linting errors (angular#5617)

    As a result of c09e8a7, a few linting errors got introduced.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants