Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

subheader: causes child attribute directives to be linked twice #11865

Open

Description

@codymikol

Bug, enhancement request, or proposal:

CodePen and steps to reproduce the issue:

Link Error Example which demonstrates the issue:

Detailed Reproduction Steps:

  1. Create an md-subheader with a child div that has an attribute directive

What is the expected behavior?

The div will be transcluded once and then its attribute directives will be linked once

What is the current behavior?

It seems that the div is transcluded twice and then one of those transclusions is immediately removed from the DOM without triggering a $destroy event.

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

This can cause event bindings via attribute directives to be fired tiwce.

Which versions of AngularJS, Material, OS, and browsers are affected?

Currently on 1.1.21

  • AngularJS: 1.7.9
  • AngularJS Material: 1.1.21
  • OS: osx
  • Browsers: Chrome / Safari / Firefox

Is there anything else we should know? Stack Traces, Screenshots, etc.

Strangely, the $destroy event is called when the actual transcluded element is destroyed, so this doesn't leave any orphaned event bindings if your own $destroy events are set up properly.

Activity

  1. codymikol commented on Feb 26, 2020

    @codymikol
    ContributorAuthor

    I'll probably dig a little be deeper into the internals of this today as this currently impacts me directly, just wanted to properly track the issue somewhere.

  2. codymikol commented on Feb 27, 2020

    @codymikol
    ContributorAuthor

    It seems to make a cloned element for the "sticky" functionality.

  3. self-assigned this
    on Apr 9, 2020
  4. Splaktar commented on Apr 9, 2020

    @Splaktar
    Contributor

    It looks like class="md-no-sticky" as mentioned in https://material.angularjs.org/latest/api/directive/mdSubheader causes the linking to only happen once.

  5. Splaktar commented on Apr 9, 2020

    @Splaktar
    Contributor

    The doc also mentions:

    Whenever the current browser doesn't support stickiness natively, the subheader will be compiled twice to create a sticky clone of the subheader.

    So it seems like this is somewhat expected?

    Though I'm surprised that it is doing this cloning on Chrome 80 based on https://caniuse.com/#feat=css-sticky.

  6. added
    needs: investigationThe cause of this issue is not well understood and needs to be investigated by the team or community
    on Apr 9, 2020
  7. added this to the - Backlog milestone on Apr 9, 2020
  8. added
    P5: nice to haveThese issues will not be fixed without community contributions.
    on Apr 9, 2020
  9. changed the title [-]md-subheader causes child attribute directives to be linked twice[/-] [+]subheader: causes child attribute directives to be linked twice[/+] on Aug 3, 2020
  10. Splaktar commented on Sep 6, 2020

    @Splaktar
    Contributor

    #9361 claims that we can solve the double compilation by re-designing the $mdSticky service, but I'm doubtful that will ever happen.

  11. removed
    needs: investigationThe cause of this issue is not well understood and needs to be investigated by the team or community
    on Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P5: nice to haveThese issues will not be fixed without community contributions.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions