You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When upgrading from 14.4.10 to 14.6.1 the anchor component no longer sets the href attribute after the initial render.
This applies to both PolymerTemplate and LitTemplate.
AnchorTest.java
package com.synesis7.sandbox;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.html.Anchor;
import com.vaadin.flow.component.littemplate.LitTemplate;
import com.vaadin.flow.component.template.Id;
import com.vaadin.flow.server.StreamResource;
@Tag("anchor-test")
@JsModule("./anchor-test.ts")
public class AnchorTest extends LitTemplate {
@Id("anchor")
private Anchor anchor;
public AnchorTest() {
StreamResource streamResource = new StreamResource("test.txt",
() -> new ByteArrayInputStream("this is a test".getBytes(StandardCharsets.UTF_8)));
anchor.setHref(streamResource);
}
}
With 14.6.4 the <a> tag inside the <anchor-test-polymer> element has an empty href. That is, it does not point to the stream resource content. With 14.4.10 the same <a> tag has a valid href pointing to a stream resource.
This is probably due to #8974 that reads the attributes so the href will be set as "" and the second setHref might be dropped from the response.
As a workaround for the problem drop the href definition from the template so that it reads <a download id="anchor"> <vaadin-button> Button </vaadin-button></a> and it should work as expected.
This is probably due to vaadin/flow#8974 that reads the attributes so the href will be set as "" and the second setHref might be dropped from the response.
As a workaround for the problem drop the href definition from the template so that it reads <a download id="anchor"> <vaadin-button> Button </vaadin-button></a> and it should work as expected.
Thanks for providing a work-around, @caalador! I can confirm it works in my demo porject.
I'll transfer this issue to the https://github.com/vaadin/flow repo since the Anchor component is a part of the standard HTML component set provided by Flow.
Activity
knoobie commentedon Jun 16, 2021
See the following discussion #10947
DiegoCardoso commentedon Jun 28, 2021
Hi @roastedcpu
Which issue you are referring to? Can you provide the steps to reproduce this issue?
roastedcpu commentedon Jun 28, 2021
Hi @DiegoCardoso
VS-3839 on Jira :)
roastedcpu commentedon Jun 28, 2021
Reported:
AnchorTest.java
anchor-test.ts
AnchorTestPolymer.java
anchor-test-polymer.js
vlukashov commentedon Jun 28, 2021
I was able to reproduce with this project (cloned from https://github.com/vaadin/skeleton-starter-flow/tree/v14).
With 14.6.4 the
<a>tag inside the<anchor-test-polymer>element has an emptyhref. That is, it does not point to the stream resource content. With 14.4.10 the same<a>tag has a validhrefpointing to a stream resource.caalador commentedon Jun 28, 2021
This is probably due to #8974 that reads the attributes so the href will be set as "" and the second setHref might be dropped from the response.
As a workaround for the problem drop the href definition from the template so that it reads
<a download id="anchor"> <vaadin-button> Button </vaadin-button></a>and it should work as expected.vlukashov commentedon Jun 28, 2021
Thanks for providing a work-around, @caalador! I can confirm it works in my demo porject.
I'll transfer this issue to the https://github.com/vaadin/flow repo since the
Anchorcomponent is a part of the standard HTML component set provided by Flow.8 remaining items
fix: set "href" for element inside template as an attribute not a pro… (
fix: set "href" for element inside template as an attribute not a pro… (
fix: set "href" for element inside template as an attribute not a pro… (
fix: set "href" for element inside template as an attribute not a pro… (
fix: set "href" for element inside template as an attribute not a pro… (
vaadin-bot commentedon Jul 15, 2021
This ticket/PR has been released with platform 14.6.6. For prerelease versions, it will be included in its final version.
vaadin-bot commentedon Jul 26, 2021
This ticket/PR has been released with platform 20.0.5. For prerelease versions, it will be included in its final version.
vaadin-bot commentedon Aug 6, 2021
This ticket/PR has been released with platform 21.0.0.beta1 and is also targeting the upcoming stable 21.0.0 version.
vaadin-bot commentedon Aug 9, 2021
This ticket/PR has been released with platform 14.7.0.alpha3 and is also targeting the upcoming stable 14.7.0 version.