Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Menu item href breaks focus (necessary to TAB twice) #191

@tomasiser

Description

@tomasiser

Bug Report

Steps

  1. Go to https://stardust-ui.github.io/react/components/menu, version 0.5.0.
  2. Edit the first example by adding href: '#', e.g., with the following code:
    import React from 'react'
    import { Menu } from '@stardust-ui/react'
    
    const items = [
      { key: 'editorials', content: 'Editorials', href: '#' },
      { key: 'review', content: 'Reviews', href: '#' },
      { key: 'events', content: 'Upcoming Events', href: '#' },
    ]
    
    const MenuExample = () => <Menu defaultActiveIndex={0} items={items} />
    
    export default MenuExample
    
  3. Try keyboard navigation (TAB key) on the menu.

Expected Result

Pressing TAB moves you to the next menu item, Shift+TAB to the previous one.

Actual Result

It is necessary to press TAB or Shift+TAB twice for each menu item. The reason is that using href changes the menu item into <a>, so there are now two nested <a> taking focus one by one.

Version

0.5.0

Metadata

Metadata

Labels

vstsPaired with ticket in vsts

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions