Comments (22)
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.
Or use the noink
attr if you aren't a fan of the ripple
from paper-button.
@robdodson @ebidel do you have any news about this?
We have the same "problem" with the paper-icon-button
.
from paper-button.
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.
+1
from paper-button.
+1
from paper-button.
from paper-button.
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.
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.
@ebidel like this?
<paper-button>
<a href="https://www.polymer-project.org">Polymer website</a>
</paper-button>
from paper-button.
Yes. It would JustWork
from paper-button.
@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.
/sub
from paper-button.
from paper-button.
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.
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 a
s?
from paper-button.
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 mousedown
s (navigation doesn't occur until mouseup
).
from paper-button.
@keanulee check the behavior with focus. :/
from paper-button.
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.
Nice @keanulee! Your welcome!
from paper-button.
Example has been added in #91
from paper-button.
@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)
- Problem with Safari HOT 1
- document.createElement('paper-button') DOMException HOT 6
- Keyboard enter or space does not trigger link HOT 3
- Button is not disabled with disabled attribute #2.0-preview HOT 1
- Cancel tap event HOT 1
- Button should always be bold (14pt Roboto medium)
- Import should be paper-material-styles for 2.0 preview HOT 4
- data-bind active attribute HOT 2
- Cannot remove underline when used with <a> HOT 2
- In #2.0-preview paper-button import paper-material.html instead of paper-material-styles.html HOT 1
- Setting the active attribute of a paper-button inserted into a slot using setAttribute requires calling it twice before it is updated. HOT 2
- paper-button throws violation warning message HOT 1
- Links in demo are announced as button HOT 1
- <paper-button> (etc) fails on polymer-3-starter-kit apps HOT 12
- paper-button page on webcomponents.org is broken HOT 6
- paper-button currently imports deprecated iron-flex-layout HOT 1
- Wrong install command in webcomponents page HOT 1
- webcomponents.org page shows wrong version for paper-button HOT 1
- npm install produce FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory HOT 3
- How to use paper button
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paper-button.