Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Polymer elements should compose organically and ergonomically with anchors #37

Open
cdata opened this issue Jan 28, 2016 · 16 comments
Open

Comments

@cdata
Copy link
Contributor

cdata commented Jan 28, 2016

This is a meta-issue to track all of the design problems with Polymer Elements as they related to HTML <a> tags.

Issues

Related PRs

@abdonrd
Copy link
Member

abdonrd commented Jan 28, 2016

Nice! More refs:

And anchor example in paper-button and paper-icon-button:

@cdata
Copy link
Contributor Author

cdata commented Jan 28, 2016

Thanks @abdonrd , I've added those to the main issue.

@srikkbhat
Copy link

One more PolymerElements/paper-checkbox#100

@abdonrd
Copy link
Member

abdonrd commented Feb 3, 2016

@abdonrd
Copy link
Member

abdonrd commented Feb 22, 2016

Another reference with paper-item: PolymerElements/paper-item#75

@ebidel
Copy link
Contributor

ebidel commented Mar 28, 2016

@cdata all of the issues looked fixed. Should we close?

@abdonrd
Copy link
Member

abdonrd commented Mar 28, 2016

@ebidel we still have the issue when we want to wait the paper-ripple effect.

And the paper-tabs puts the anchor inside the paper-tab. 😕

@robdodson
Copy link

I'm working on a fix for paper-tabs

@abdonrd
Copy link
Member

abdonrd commented Mar 28, 2016

@robdodson nice! The anchor will be outside the paper-tab? Like the rest of paper elements.

<paper-tabs>
  <a href="#inbox" tabindex="-1">
    <paper-tab>Inbox</paper-tab>
  </a>
  <a href="#starred" tabindex="-1">
    <paper-tab>Starred</paper-tab>
  </a>
</paper-tabs>

@robdodson
Copy link

No I was planning to leave it inside the tab. Basically doing the fix proposed here: PolymerElements/paper-tabs#141

@robdodson
Copy link

btw that paper-item fix seems wrong. If the anchor is tabindex=-1 you'll never be able to activate it from a keyboard. It'll only work for mouse users

@robdodson
Copy link

hm actually it does seem to work. I guess the anchor picks up the event dispatched from the inner child and it gets counted as an anchor click

@abdonrd
Copy link
Member

abdonrd commented Mar 29, 2016

It's a bit inconsistent have elements that have the anchor inside and others outside. It would be great if we can unify.

@robdodson
Copy link

@abdonrd I agree. We would have to change the way paper-tabs does distribution to make the other proposal work which would be a pretty big change.

@abdonrd
Copy link
Member

abdonrd commented Sep 12, 2018

@cdata @robdodson @ebidel Sorry for reliving this post after so long, but...

Today a friend has shared this post with me:
Can I nest a <button> element inside an <a> using HTML5?

And I remember these PRs where we wrapped the elements with the <a>:

It seems that according to the HTML5 Spec Document from W3C about the a element, the content model must be:

Transparent, but there must be no interactive content or a element descendants.

As the interactive content includes the button element...
I guess we should face this in another way, right?

Thanks in advance!

@robdodson
Copy link

I think it's probably fine to have element descendants inside of <a>.

If you're just using native HTML, then it doesn't make sense to put <button> inside of <a> because, semantically, <button> performs an action on a page and <a> is a link to another page.

It might be worth overriding the role on paper-button and paper-icon-button if you're using them inside of an <a>. You may just want to do:

<a href="https://example.com"
  <paper-button role="group">Example.com</paper-button>
</a>

That would tell the accessibility tree to treat paper-button like a div or a span and just read the text content inside of it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants