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

Unexpected page reload when clicking on a link with svg "use" element #527

Closed
TatriX opened this issue Aug 31, 2020 · 0 comments · Fixed by #528
Closed

Unexpected page reload when clicking on a link with svg "use" element #527

TatriX opened this issue Aug 31, 2020 · 0 comments · Fixed by #528
Labels
bug Something isn't working

Comments

@TatriX
Copy link
Member

TatriX commented Aug 31, 2020

Here's a demo:

a![
            style!{
                St::Display => "flex",
                St::Border => "1px solid pink",
                St::Width => px(80),
                St::Height => px(80),
                St::JustifyContent => "center",
                St::AlignItems => "center",
            },
            attrs!{
                At::Href => "/foo",
            },
            svg![
                attrs!{
                    At::Width => px(40),
                    At::Height => px(40),
                },
                r#use![attrs!{
                    At::Href => "/icons.svg#ic:outline-double-down"
                }],
            ],
        ],

Add this for example to /examples/counter/src/lib.rs

<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg">

  <symbol id="ic:outline-double-down" viewBox="0 0 15 14">
    <path d="M3.52051 8.75L3.52051 6.125L7.60384 9.04167L11.6872 6.125L11.6872 8.75L7.60384 11.6667L3.52051 8.75Z" fill="#B44C4C"/>
    <path d="M3.52051 4.66626L3.52051 2.04126L7.60384 4.95793L11.6872 2.04126L11.6872 4.66626L7.60384 7.58293L3.52051 4.66626Z" fill="#B44C4C"/>
  </symbol>

</svg>

and this to /examples/counter/icons.svg.
Clickling on the icon in the middle of the link will reload the page. Probably this happens because of href in ` tag.

@TatriX TatriX changed the title Unexpected page reload whcn clickin on a link with svg "use" element Unexpected page reload when clicking on a link with svg "use" element Aug 31, 2020
@MartinKavik MartinKavik added 0.8.0 bug Something isn't working labels Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants