Skip to content

Tabs with autoselect=false has LAST tab as default tab-stop #6392

Closed

Description

@rolfsmeds

Description

A Tabs component with autoselect disabled (so that no tab is selected by default), sets tabindex="0" on the last tab by default for some reason, which is quite confusing for any user and probably especially problematic for screen reader users.

Expected outcome

The default tab stop should be on the first tab.

Minimal reproducible example

https://vaadin.com/docs/latest/components/tabs#autoselect-java-only

Steps to reproduce

Tab to focus the Tabs in the sample, and observe that the last tab gets focused first.

Environment

Vaadin version(s): V24

Browsers

Issue is not browser related

Activity

  1. self-assigned this
    on Jul 19, 2024
  2. web-padawan commented on Jul 19, 2024

    @web-padawan
    Member

    The reason is that Tabs are using setSelectedIndex(-1); in the constructor and with autoselect set to false, this doesn't get changed. Actually, the issue can also be reproduced in the web component using following code example:

    <vaadin-tabs selected="-1">
      <vaadin-tab>Foo</vaadin-tab>
      <vaadin-tab>Bar</vaadin-tab>
      <vaadin-tab>Baz</vaadin-tab>
    </vaadin-tabs>

    Same issue affects vaadin-list-box as the problematic code is in ListMixin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a11yAccessibility issuebugSomething isn't workingvaadin-tabs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions