Lwc: Replacement of id in hrefs

Created on 18 Mar 2019  路  5Comments  路  Source: salesforce/lwc

Description

In v 37.0, we started seeing some issues in some href pointing to ids, like #someId.

Steps to Reproduce

lwc v0.37.0: https://playground.lwcjs.org/projects/LdvLwWJGw/2/edit

Expected Results

I expect the href is not changed.

The expected result can be seen in v0.36.0:

lwc v0.36.0: https://playground.lwcjs.org/projects/LdvLwWJGw/1/edit
Notice how the generated html is: <a lightning-breadcrumb_breadcrumb="" href="#someId">breadcrumb pointing to some #someId</a>

Actual Results

lwc v0.37.0: https://playground.lwcjs.org/projects/LdvLwWJGw/2/edit
Notice how the genereted html differs: <a lightning-breadcrumb_breadcrumb="" href="#someId-2">breadcrumb pointing to some #someId</a> (especially: href="#someId-2")

Browsers Affected

All

Version

  • LWC: 0.37.0

Most helpful comment

That is true if you are in a pure LWC app, when interacting with aura, this might be a use case.

All 5 comments

fyi @ekashida

@jodarove I understand the result that you expect, but I'm not clear on what the use case for it is. Fragment-only URLs can only reference IDs in the same shadow. Since the corresponding ID should also have been transformed, the association should be preserved.

If the breadcrumb is supposed to reference an element outside of its shadow, then it sounds like this is actually a bug with lightning-breadcrumb and we will need to discuss some other alternative.

That is true if you are in a pure LWC app, when interacting with aura, this might be a use case.

@ekashida can we close this now?

The observed behavior in 0.37.0 is what we want. The change was reverted and will be released in the future. It is tracked by #1150.

Was this page helpful?
0 / 5 - 0 ratings