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

feat: [draft] add split button spec #4083

Closed
wants to merge 2 commits into from

Conversation

brookdozer
Copy link
Contributor

Description

Adds a specification for split button web component

Motivation & context

FAST needs a spec for a split button web component both for parity with Fluent and with other design systems.

ASKs:

  • Should the buttons be buttons or merely styled like buttons? (If buttons, then listbox is out)
  • Should this take a dependency on popover/flyout or listbox?
  • Help with the implementation details: slots, properties, events
    • How to manage the collection of buttons? One list and assume the first is primary? A primary and secondary slots?
    • In the modal version (e.g., reactions) How best to show the chosen action in its "checked" state in the Primary slot?
    • How best can the menu button interact with the popover/flyout/listbox?
    • Should this be just a simple Fluent/Bootstrap-style split button AND a Facebook-style reaction button?

Issue type checklist

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

Is this a breaking change?

  • This change causes current functionality to break.

Adding or modifying component(s) in @microsoft/fast-components checklist

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

@janechu
Copy link
Collaborator

janechu commented Nov 3, 2020

Can we take the w3c naming menu-button if this is effectively always going to pop up a list of potential actions? Since this is a w3c spec I am alright with this going into fast-foundation. I'll refrain from further spec comment until the naming is sorted out since GitHub tends to lose track of comments when files get moved around.

@chrisdholt
Copy link
Member

Can we take the w3c naming menu-button if this is effectively always going to pop up a list of potential actions? Since this is a w3c spec I am alright with this going into fast-foundation. I'll refrain from further spec comment until the naming is sorted out since GitHub tends to lose track of comments when files get moved around.

Slight nuance here. Split button includes a menu button but is not exclusively a menu button. Split button has essentially two buttons, one being a menu button and one being a standard button.

@janechu
Copy link
Collaborator

janechu commented Nov 3, 2020

I think if the menu always has to be included and is a w3c spec, we can make the "standard" button optional, that way we can rename this to menu-button and serve both purposes. This would increase flexibility for the component.

@chrisdholt
Copy link
Member

I think if the menu always has to be included and is a w3c spec, we can make the "standard" button optional, that way we can rename this to menu-button and serve both purposes. This would increase flexibility for the component.

I like this idea - thoughts @brookdozer ?

@brookdozer
Copy link
Contributor Author

I think if the menu always has to be included and is a w3c spec, we can make the "standard" button optional, that way we can rename this to menu-button and serve both purposes. This would increase flexibility for the component.

@chrisdholt and @janechu, I'd be more inclined to create a separate menu-button component and use that inside split-button although the unique requirements of a stateful split-button might make that tricky.

Do folks already use fast-button as a menu button by adding aria-haspopup and aria-controls or do we need a menu-button control?

@stale
Copy link

stale bot commented Dec 25, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the warning:stale No recent activity within a reasonable amount of time label Dec 25, 2020
@EisenbergEffect
Copy link
Contributor

Just checking in to see if you are ready for another round of reviews @brookdozer or if you are still in process on the current feedback. Thanks!

@stale stale bot removed the warning:stale No recent activity within a reasonable amount of time label Jan 22, 2021
Copy link
Collaborator

@litteredwitherrors litteredwitherrors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I wonder about the general composition of the component dependencies as well as the conveyance of the properties when composed. Somethings come to mind when using the Github review UI:
image

Would there ever be a circumstance where we'd have a much more complex pop-over? If so, we should consider how can provide support for this level of complex UI.

@@ -0,0 +1,220 @@
# Split Button

This is the working branch for the `split-button` component spec. It is still in development and implementation details are rough but should be ready for high-level feedback and discussion.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can frame this to be more declarative and let the "draft" status communicate it being "WIP".


## Overview

A `fast-split-button` is a primary action button and a collection of related action buttons. The primary button is shown and the related buttons are hidden in a menu. It takes takes two forms:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this pattern should inherently include a fly-out. The fly-out could be its own component altogether. If this is a pattern that always includes a fly-out, then perhaps it should be name something else.

- The menu should allow for horizontal or vertical layout
- Works with mouse, touch or keyboard navigation
- Mouse:
- Hover on `split-button` container **may** show the related actions or may show a Down Arrow
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this decided?


*Slots:*
- `primary-button` - the primary action button
- `expand-glyph` - glyph that indicates the select is expandable, often a downward chevron
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming needs to be considered for this slot.

*Slots:*
- `primary-button` - the primary action button
- `expand-glyph` - glyph that indicates the select is expandable, often a downward chevron
- `related-buttons` - collection of buttons that will be displayed in the popover menu
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the pop-over only ever display buttons?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question. It seems like it should only ever be buttons in a split button pop-over, but I could be wrong. Maybe a divider?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Brook. A scenario comes to mind when an engineer might want to put something else in the popover. For instance, Github has many "split button" patterns that go from simple content:
image

To more complex content:
image

This might be something we want to consider in this component.


![image of a split button from Microsoft Teams](images/split-button_example_Teams.png)

2. **Stateful split button**: a button and popover as seen here in Facebook's "Like" button:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we technically mean by the component being "stateful".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A stateful split button is one that stores state, similar to a "like" button. The opposite would be a similar to the email "Send | Send Later" button.

@EisenbergEffect
Copy link
Contributor

This one's very old. @chrisdholt What would you like to do with it?

@chrisdholt
Copy link
Member

This one's very old. @chrisdholt What would you like to do with it?

Per @janechu's comments above on "menu button", I think we'll close this and pick it up in coordination with that component, requested in #5469. My initial thought on accomplishing the split button would be slotting a button in the start or end slot.

@chrisdholt chrisdholt closed this Feb 4, 2022
@JudahGabriel JudahGabriel mentioned this pull request Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:fast-foundation Pertains to fast-foundation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants