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(DataTable): option to show overflow menu on hover #5822

Merged
merged 3 commits into from
Apr 9, 2020

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Apr 8, 2020

This change introduces overflowMenuOnHover prop to <DataTable> that determines whether or not to show overflow menu on hover, by changing CSS class of <Table> as follows:

  • overflowMenuOnHover={true} unsets bx--data-table--visible-overflow-menu
  • overflowMenuOnHover={false} sets bx--data-table--visible-overflow-menu

That CSS class changes the behavior of overflow menu in <TableCell className="bx--table-column-menu">; The former above shows overflow menu only on hover, the latter above shows overflow menu always.

Though our latest design dictates that showing overflow menu on hover should be optional, this change sets overflowMenuOnHover={true} as the default. This is because of the following reasons:

  1. <DataTable> has never set bx--data-table--visible-overflow-menu before and thus setting it by default will be a breaking change
  2. Showing overflow menu always can alternately be (and has been in our stories) achieved by not setting className="bx--table-column-menu" to <TableCell>

Fixes #5804.

Changelog

New

  • overflowMenuOnHover prop to <DataTable>

Testing / Reviewing

Testing should make sure <DataTable> with overflow menu isn't broken.

This change introduces `overflowMenuOnHover` prop to `<DataTable>` that
determines whether or not to show overflow menu on hover, by changing
CSS class of `<Table>` as follows:

* `overflowMenuOnHover={true}` _unsets_
  `bx--data-table--visible-overflow-menu`
* `overflowMenuOnHover={false}` _sets_
  `bx--data-table--visible-overflow-menu`

That CSS class changes the behavior of overflow menu in
`<TableCell className="bx--table-column-menu">`; The former above shows
overflow menu only on hover, the latter above shows overflow menu
always.

Though our latest design dictates that showing overflow menu on hover
should be optional, this change sets `overflowMenuOnHover={true}` as the
default. This is because of the following reasons:

1. `<DataTable>` has never set `bx--data-table--visible-overflow-menu`
   before and thus setting it by default will be a breaking change
2. Showing overflow menu always can alternately be (and has been in our
   stories) achieved by _not_ setting
   `className="bx--table-column-menu"` to `<TableCell>`

Fixes carbon-design-system#5804.
@asudoh asudoh requested review from emyarod, a team and laurenmrice and removed request for a team April 8, 2020 09:11
@ghost ghost requested review from aledavila and removed request for a team April 8, 2020 09:12
@netlify
Copy link

netlify bot commented Apr 8, 2020

Deploy preview for carbon-elements ready!

Built with commit 846fc3a

https://deploy-preview-5822--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Apr 8, 2020

Deploy preview for carbon-components-react ready!

Built with commit 846fc3a

https://deploy-preview-5822--carbon-components-react.netlify.com

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me pending design review. on a side note should we center the overflow menu triggers in each row?

image

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

Yes to what @emyarod said. The overflows should be centered vertically within each row.

@asudoh asudoh requested a review from a team as a code owner April 9, 2020 07:29
@asudoh
Copy link
Contributor Author

asudoh commented Apr 9, 2020

Thanks you for reviewing @emyarod @laurenmrice - Fixed.

@ghost ghost requested a review from tw15egan April 9, 2020 07:29
Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

looks good to me ! thanks 🙌🏻

Copy link
Member

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

👍 ✅

@tw15egan tw15egan merged commit 6795904 into carbon-design-system:master Apr 9, 2020
@asudoh asudoh deleted the overflow-menu-on-hover branch April 9, 2020 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overflow menu for data table rows should be visible on hover
4 participants