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.

[RFC] MenuItem Children API #79

@miroslavstastny

Description

@miroslavstastny

When implementing menu accessibility (#61), MenuItem (which by default renders as li > a) was modified and onClick handler as well as several styling were moved from li to a.

That works correctly for ShorthandApi, but unfortunately it breaks ChildrenApi. It was agreed previously that <Menu.Item>children</MenuItem> renders as <li>children</li>.
That worked previously as all the styles and onClick were on the li, but it is broken now.

I was thinking about splitting ListItem to ListItem (which renders as li) and ListItemLink (which renders as a). I played with the code to test this approach and it seems to work. The only problem I see is that a developer must pass the same props to several components:

<Menu>
  <Menu.Item>
    <Menu.Item.Link>
    </Menu.Item.Link>
  </Menu.Item>
</Menu>

Now if you want to make the menu to be vertical, you must add vertical to all Menu, Menu.Item and Menu.Item.Link. For an active item, you must add active to both Menu.Item and Menu.Item.Link.

What is our plan for supporting Children API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCvstsPaired with ticket in vsts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions