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

Create HLD for action menus in the table #956

Merged
merged 20 commits into from
Jan 19, 2023
Merged

Conversation

mollykreis
Copy link
Contributor

Pull Request

🀨 Rationale

Create a spec for #859

πŸ‘©β€πŸ’» Implementation

N/A

πŸ§ͺ Testing

N/A

βœ… Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@@ -151,14 +149,16 @@ _Functions_

_Events_

Placeholder
- `action-menu-opening` - An event that is emitted immediately prior to the action menu opening. This can be used to update the items in the menu so that they are in the correct state for the row(s) the menu is associated with. The event details include the following:
Copy link
Member

@rajsite rajsite Jan 12, 2023

Choose a reason for hiding this comment

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

Html spec for popovers just got approved! The event for "I'm about to open but haven't opened yet" is "popovershow": https://open-ui.org/components/popup.research.explainer#events

So for our custom event I'd keep the hyphens but suggest we go action-menu-show

Copy link
Member

@rajsite rajsite Jan 12, 2023

Choose a reason for hiding this comment

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

Discussion on why popover naming differs from dialog openui/open-ui#322
From a method point of view (dialog does not have a "show" type event while popover does)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm guessing this naming convention should also be applied to the nimble-menu-button? Should the new event I'm proposing to add on that component be show rather than opening? It already has an event named open-change that fires right after the menu is opened or closed. Do you think there is a better name for the existing event? I don't see an event in the popup spec that aligns with our existing event. It would be a breaking change, but I don't think there are any usages of it (at least in SLE).

Copy link
Member

Choose a reason for hiding this comment

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

turns out the popover merge jumped the gun, was reverted, and reopened πŸ˜…

Also the explainer I linked seems to be out of date with the current changes, it looks like the current idea (most likely to merge I think) is a single toggle event instead of separate show/hide.

That seems more in line with the "open-change" on menu-button.

(haven't fully responded to your qs yet, just posting some updates)

Copy link
Member

@rajsite rajsite Jan 18, 2023

Choose a reason for hiding this comment

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

Looks like it's settling on beforetoggle and toggle with newState and oldState in details: whatwg/html#8717 (comment)

Wanna copy beforetoggle for the menu-button? Seems like reasonable alignment (since eventually we will probably use that feature).

Guess we still want to scope the name in table since there will be other "toggley" things happening, so action-menu-beforetoggle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

beforetoggle on the menu-button and action-menu-beforetoggle seem like reasonable names to me. I assume that means we'd also want to fire the events right before they close too. Is that your thought as well? I'm guessing most clients will only care about the menu opening, but it seems odd to have a beforetoggle event that only fires when toggling in one direction (i.e. from closed to open).

Copy link
Member

Choose a reason for hiding this comment

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

assume that means we'd also want to fire the events right before they close too
yep! makes sense to do it in both toggle directions πŸ‘

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated all the table-related specs. I plan to update the README for the menu-button when I make the changes to that component.

@rajsite rajsite mentioned this pull request Jan 18, 2023
1 task
Co-authored-by: Jesse Attas <jattasNI@users.noreply.github.com>
@mollykreis mollykreis enabled auto-merge (squash) January 19, 2023 21:32
@mollykreis mollykreis merged commit 8315843 into main Jan 19, 2023
@mollykreis mollykreis deleted the table-action-menu-spec branch January 19, 2023 21:44
@mollykreis mollykreis mentioned this pull request Jan 20, 2023
1 task
mollykreis added a commit that referenced this pull request Jan 26, 2023
# Pull Request

## 🀨 Rationale

Some changes need to be made to the menu button before it can be used
within the table for the action menu. Specifically, those changes are:
- adding a `beforetoggle` event
- having the menu button find the slotted menu when it is nested within
multiple slots

See #956 for more details.

## πŸ‘©β€πŸ’» Implementation

- Add `beforetoggle` event to the menu button that is fired before the
menu opens or closes
- Add Angular & Blazor support for the `beforetoggle` event
- Change the logic for finding the slotted menu. We can no longer use a
filter in the template to find slotted elements with a role of `menu`
because this won't match `slot` elements. Instead, the template assigns
all slotted elements to the `slottedMenus` array, and the getter for
`menu` finds the menu, which may be nested within `slot` elements.

## πŸ§ͺ Testing

- Manually tested that the `beforetoggle` event handler works correctly
in Blazor & Angular
- Added auto tests for the `beforetoggle` event works correctly for the
web components
- Basic manual testing in Storybook that the component still behaves as
expected
- Added tests that the focus & menu opening behavior works correctly
when the menu is nested in an additional slot

## βœ… Checklist

<!--- Review the list and put an x in the boxes that apply or ~~strike
through~~ around items that don't (along with an explanation). -->

- [ ] I have updated the project documentation to reflect my changes or
determined no changes are needed.
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

Successfully merging this pull request may close these issues.

4 participants