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

Use anchor tags as Tab links #250

Open
nielsdB97 opened this issue Jun 15, 2018 · 5 comments
Open

Use anchor tags as Tab links #250

nielsdB97 opened this issue Jun 15, 2018 · 5 comments

Comments

@nielsdB97
Copy link

nielsdB97 commented Jun 15, 2018

I think it'd be better for semantics to use <a> tags instead of <li> tags for the Tab buttons.
This article reminded me of this, stating that

If it (the button) goes to a different URL or changes most of the page’s content, use a link ()

I reckon a tab usually does change most of the page's content, so we should use anchor tags.

@nielsdB97
Copy link
Author

Please let me know if this is desired, if so I'd be happy to submit a PR 👍

@twidero
Copy link

twidero commented Oct 26, 2018

Agreed. Use basic html rather than scripting <li> tags to be clickable.

Take the example with Avengers icons in the tabs: http://reactcommunity.org/react-tabs/
If one of these icons has an empty alt="" tag, a WCAG-validator like aXe won't notice the bug because it doesn't recognise <li> as a clickable element that must have readable content.

@evoyy
Copy link

evoyy commented Apr 26, 2020

I think this would be good for SEO. Most of my content is accessed via tabs and I'm not sure that search bots are seeing it. For now I'm using anchors inside the tabs like this:

    <TabList>
      <Tab><a>Title 1</a></Tab>
      <Tab><a>Title 2</a></Tab>
    </TabList>

@larrybotha
Copy link

It wouldn't necessarily be a link, either, as a button could be appropriate depending on the context, too.

A link could suggest:

  • hashed navigation between tabs on a single page
    • e.g. each TabPanel represents a different hash on the URL (example.com#tab-panel-1, etc.), or
  • navigation between different URLs
    • e.g. each TabPanel represents a different URL inside a router (example.com/path-1, etc.)

A button would be appropriate if you're changing content without affecting the URL.

Defaulting to a link or button, and allowing the user to override the tag would likely be a good approach while maintaining semantic use of the HTML tags used for interaction

@encryptblockr
Copy link

will this ever be implemented? will b e great to have this

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

No branches or pull requests

5 participants