Closed Platonn closed 1 year ago
href="/electronics-spa/en/USD/faq#c00"
instead of just href="#c00"
); browser's "back" button works but position is not preserved (won't go to the top). Solution to consider:
@Xymmer According to our talk the decision is about:
OR
we'll go with changing spa code so we handle our default sample data, but we won't go crazy trying to handle all kinds of html that could be added in the future
Just be aware of:
Moving this back to TODO as I didn't have time to think about this more. Basically, long term solution (cms-driven approach) depends on CMSX-8545 (extend the current link component functionality to handle in-page jumps). The temporary solution is about either:
target
(weird)id
attr (seems overkill)see https://github.com/angular/angular/blob/master/packages/core/src/sanitization/html_sanitizer.ts#L69
we'll have to schedule this one, talk to bill before taking this
Hi any news on this ? My customer needs FAQ page links.
@AbdelhalimOuasti since this is a sample data issue, you would normally have to customize the faq links. Is there something about this issue that is to be added generically to Spartacus itself?
Hi the problem is that the generated html does not keep the anchor :
- impex : <h2><a name=""l00""></a>Privacy and security</h2>
- HTML : <h2><a></a>Privacy and security</h2>
Can this issue be solved in 4.0?
Even after fixing the sample data, anchor names are not rendered (since DomSanitizer omits them)
A solution needs to be discussed for this one. Either we bypass DOM sanitization and trust HTML coming from the CMS or we come up with a more robust component. Ideas welcome.
Local #anchor
links in ParagraphComponent were fixed in https://github.com/SAP/spartacus/issues/14108
For other issues with ParagraphComponent, please create a new bug ticket, if needed.
Duplicate of #14108
CMS' HTML content may contain ordinary links (
<a href>
), but they may not work properly due to many reasons. For example, user is at/faq
page and the CMS' HTML content contains links like:<a href="#anchor">
. This causes prolems, as long as we have<base href="/">
, because those links direct to/#anchor
which is home page, not/faq#anchor
.Various cases should be also tested:
#anchor
links../../some-route
and to deeper pages./some/nested/route
Ideally, we would like to avoid full reloads of page after clicking a relative link (in scope of SPA). Unfortunately a native
<a href>
is not the case.We should investigate how to prepare links in CMS to work properly in Spartacus and/or think about some mechanism (pipe?) to fix those links before rendering with `[innerHTML] directive if necessary.
Related issues: FAQ https://github.com/SAP/cloud-commerce-spartacus-storefront/issues/3482 T&C https://github.com/SAP/cloud-commerce-spartacus-storefront/issues/3506