Giter Club home page Giter Club logo

Comments (22)

cdata avatar cdata commented on July 17, 2024 3

After thinking about this for a bit, I believe the ideal we should strive for is this form:

<a href="https://www.polymer-project.org">
  <paper-button>Polymer website</paper-button>
</a>

However, there may be problems with this form (e.g., a parent expects a specific kind of child, so wrapping is not an option). Are there any known conditions that you guys have run into where this would not work?

And if we use a declarative , we lost the ripple

I tested this and the ripple seems to work fine in this condition.

from paper-button.

robdodson avatar robdodson commented on July 17, 2024 2

Or use the noink attr if you aren't a fan of the ripple

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024 2

@robdodson @ebidel do you have any news about this?

We have the same "problem" with the paper-icon-button.

from paper-button.

ebidel avatar ebidel commented on July 17, 2024 1

Here's one way:

<paper-button onclick="addNewFeature(this)"></paper-button>

function addNewFeature(el) {
  // Wait for ripple to finish.
  el.addEventListener('transitionend', function(e) {
    location.href = '/admin/features/new';
  });
}```

You could also use a declarative `<a>` and prevent the click, wait for the ripple to finish, and then do the redirect.

from paper-button.

SayChunKim avatar SayChunKim commented on July 17, 2024

+1

from paper-button.

gulyasfeccferenc avatar gulyasfeccferenc commented on July 17, 2024

+1

from paper-button.

kaycebasques avatar kaycebasques commented on July 17, 2024

👍 AKA +1

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024

With the @ebidel way, we need to write a javascript function...

<paper-button onclick="addNewFeature(this)"></paper-button>
function addNewFeature(el) {
  // Wait for ripple to finish.
  el.addEventListener('transitionend', function(e) {
    location.href = '/admin/features/new';
  });
}

And if we use a declarative <a>, we lost the ripple and maybe it is an ugly code:

<a href="https://www.polymer-project.org">
    <paper-button>Polymer website</paper-button>
</a>

We can have something like this?

<paper-button href="https://www.polymer-project.org">Polymer website</paper-button>

from paper-button.

ebidel avatar ebidel commented on July 17, 2024

I don't think href makes sense on paper-button, but it would be nice if paper-button knew it had a anchor children and had a feature that de-janked the ripple for you.

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024

@ebidel like this?

<paper-button>
    <a href="https://www.polymer-project.org">Polymer website</a>
</paper-button>

from paper-button.

ebidel avatar ebidel commented on July 17, 2024

Yes. It would JustWork®️

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024

@ebidel and we have the same problem with the paper-icon-button.
It would be something like this? An empty <a> is strange.

<paper-icon-button icon="polymer">
    <a href="https://www.polymer-project.org"></a>
</paper-icon-button>

from paper-button.

MeTaNoV avatar MeTaNoV commented on July 17, 2024

/sub

from paper-button.

cdata avatar cdata commented on July 17, 2024

@robdodson @ebidel @abdonrd ^

from paper-button.

robdodson avatar robdodson commented on July 17, 2024

That looks fine to me. I would maybe put noink on the button to get rid of
the ripple so it doesn't jank the page.
On Dec 16, 2015 3:15 PM, "Christopher Joel" [email protected]
wrote:

@robdodson https://github.com/robdodson @ebidel
https://github.com/ebidel @abdonrd https://github.com/abdonrd ^


Reply to this email directly or view it on GitHub
#35 (comment)
.

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024

Thanks @cdata!

I can you show an use of case when we have problems: http://jsbin.com/kuyisinara
We have a small problem, easily solved with CSS.
But try to use the tab key and see the focus behavior. :(

The solution would be to add the tabindex="-1" to the as?

from paper-button.

keanulee avatar keanulee commented on July 17, 2024

Added an example of this in #91. I decided to leave out the noink attribute since it's nice to see the ripple effect when the user mousedowns (navigation doesn't occur until mouseup).

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024

@keanulee check the behavior with focus. :/

First tab:
screen shot 2016-01-21 at 20 17 42

Second tab:
screen shot 2016-01-21 at 20 17 50

from paper-button.

keanulee avatar keanulee commented on July 17, 2024

Ah yes, that is an issue. Easy way to fix this is to add tabindex="-1" to the <a> tag. <paper-button> would still be able to receive focus, and you can still navigate. I'll add this to #91. Thanks @abdonrd

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024

Nice @keanulee! Your welcome!

from paper-button.

keanulee avatar keanulee commented on July 17, 2024

Example has been added in #91

from paper-button.

abdonrd avatar abdonrd commented on July 17, 2024

@keanulee It would be great if you add another example waiting to finish the ripple effect before opening the link. 😊

from paper-button.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.