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(table): add tooltips to buttons and shrink icon size to 16 px, upgrade Carbon to v10.12.0 #1238

Merged
merged 14 commits into from
Jun 2, 2020

Conversation

scottdickerson
Copy link
Contributor

@scottdickerson scottdickerson commented May 28, 2020

Closes #975
Closes #1174
Closes https://github.ibm.com/Watson-IoT/pal-tracking/issues/399
Closes #1080

Summary
image

Fixes the toolbar buttons to be 16 px instead of 20, to use the official Carbon icon only buttons and to support tooltips. Also adds an active state to the button.

Change List (commits, features, bugs, etc)

  • chore(carbon): upgrade carbon to latest version 10.12.0 to get TableToolbarSearch fix
  • chore(package.json): increase the heap size for storybook (change for new carbon)
  • test(*Snapshots): lots of snapshot updates due to the new carbon
  • test(StorySnapshotsTest): needed to exclude two new DatePickerInput propTypes errors (opened a bug on Carbon to fix)
  • test(Table.story): fix downloadCSVHandler button to actually work in the story
  • test(Table.test): new Button elements no longer listen to onKeyDown, but do work with the enter key
  • refactor(TableToolbar): change back to Carbon TableToolbarSearch widget, use default Search icon size. Remove local copy of TableToolbarSearch.
  • fix(TableToolbarSVGButton): use official Carbon iconOnly button, support active state
  • chore(TileGallerySection): remove the Expand/Collapse i18n (change for new carbon)
  • fix(Table): allow overflow so that the tooltips can show at the top of the table
  • fix(baseTableReducer): because the search propType was renamed to 'defaultValue' from 'value' in a previous track need to use that in the reducer otherwise we will get a propTypes error after search

Acceptance Test (how to verify the PR)

  • Verify in this story watson-iot-table--stateful-example-with-expansion-maxpages-and-column-resize that the tooltips, and active button states work correctly. Verify the keyboard support of all the toolbar buttons

package.json Outdated
@@ -86,8 +86,8 @@
"@carbon/layout": "10.7.1",
"@carbon/motion": "10.6.0",
"@carbon/themes": "10.10.3",
"carbon-components": "10.10.3",
"carbon-components-react": "7.10.3",
"carbon-components": "^10.12.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

These should be pinned to specific version.

Suggested change
"carbon-components": "^10.12.0",
"carbon-components": "10.12.0",

package.json Outdated Show resolved Hide resolved
@netlify
Copy link

netlify bot commented May 28, 2020

Deploy preview for carbon-addons-iot-react ready!

Built with commit d4c65b8

https://deploy-preview-1238--carbon-addons-iot-react.netlify.app

@netlify
Copy link

netlify bot commented May 28, 2020

Deploy preview for carbon-addons-iot-react ready!

Built with commit 05764e4

https://deploy-preview-1238--carbon-addons-iot-react.netlify.app

@@ -26,6 +20,11 @@ div.#{$prefix}--toolbar-action.#{$prefix}--toolbar-search-container-expandable {
padding-top: $spacing-01;
}

// small fix to allow tooltips to show outside the toolbar if the batch action isn't active
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice, I was just fighting the clip-path myself, trying to figure out how to work around it without causing a breaking change. So you are sure it was only needed for the batch actions and not for anything else? What about custom toolbar content that might rely on it?

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 believe so @bjornalm I almost opened a bug on carbon to only set the clip-path initially if the batch actions was active to make sure they approved.

Comment on lines -14734 to -14915
"defaultProps": Object {
"accept": Array [],
"buttonKind": "primary",
"disableLabelChanges": false,
"disabled": false,
"labelText": "Add file",
"multiple": false,
"onChange": [Function],
"onClick": [Function],
"role": "button",
"tabIndex": 0,
},
Copy link
Member

Choose a reason for hiding this comment

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

We should look into Carbon changelogs to see why this has changed.

package.json Outdated
@@ -35,7 +35,7 @@
"lint:stylelint": "stylelint './src/**/*.scss' --syntax scss --ignorePath .gitignore",
"prepare": "yarn build",
"publish-npm": "yarn semantic-release",
"start": "yarn test:engines && yarn storybook",
"start": "yarn test:engines && NODE_OPTIONS='--max-old-space-size=16384' yarn storybook",
Copy link
Member

Choose a reason for hiding this comment

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

Could you try a killall node -9 and then try running this command?

I assume you saw a heap out of memory error and added this. These are typically a result of resource issues on the local machine vs a reproducible issue across other machines. We shouldn't set this flag unless necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it's fine if you wanna take it out, but I couldn't even get my initial build to work without it, and as far as I could tell I didn't have anything else eating local memory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no luck with the killall node -9 even after reboot, I couldn't do the yarn start without upping the heapsize! not sure if something is strange with the new carbon.

scottdickerson and others added 2 commits May 28, 2020 16:56
Co-authored-by: David Conner <david@david-conner.com>
Copy link
Contributor

@stuckless stuckless left a comment

Choose a reason for hiding this comment

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

A couple things I noticed on the following story
https://deploy-preview-1238--carbon-addons-iot-react.netlify.app/?path=/story/watson-iot-table--with-resize-hascolumnselection-and-initial-column-widths

  1. Do we want the tooltips to appear immediately (as they do), to on a timer on hover (like most tooltips in html). Is there anything in the design for that. I can see lots of comments coming back from users with inconsistencies if we do it immediately here on these buttons, but, don't do it immediately on all buttons, etc, or just the annoyance of it being immediate. Once you know the buttons, having the tooltips is more annoying than helpful.

  2. The tooltips clip off the screen. It's pretty much a guarantee that tooltips will will larger descriptions esp in different languages, and that these buttons are going to pushed to the edge of the screen (in both rtl and ltr environments)

  3. The entire window body adds in horz scrollbar. This is ugly, and it's not like we can actually scroll the page to see the tooltip, since, as soon as you mouse away the toolttip is gone.

Almost like we need a universal tooltip manager to mange using tooltips in all cases.

@scottdickerson
Copy link
Contributor Author

A couple things I noticed on the following story
https://deploy-preview-1238--carbon-addons-iot-react.netlify.app/?path=/story/watson-iot-table--with-resize-hascolumnselection-and-initial-column-widths

  1. Do we want the tooltips to appear immediately (as they do), to on a timer on hover (like most tooltips in html). Is there anything in the design for that. I can see lots of comments coming back from users with inconsistencies if we do it immediately here on these buttons, but, don't do it immediately on all buttons, etc, or just the annoyance of it being immediate. Once you know the buttons, having the tooltips is more annoying than helpful.
  2. The tooltips clip off the screen. It's pretty much a guarantee that tooltips will will larger descriptions esp in different languages, and that these buttons are going to pushed to the edge of the screen (in both rtl and ltr environments)
  3. The entire window body adds in horz scrollbar. This is ugly, and it's not like we can actually scroll the page to see the tooltip, since, as soon as you mouse away the toolttip is gone.

Almost like we need a universal tooltip manager to mange using tooltips in all cases.

@CynZhang what do you think?

@scottdickerson
Copy link
Contributor Author

ok @stuckless resubmitted after talking with @CynZhang and we gonna go with the native browser tooltips for now until Carbon gives us more options to make the default tooltips less intrusive.

@scottdickerson
Copy link
Contributor Author

@CynZhang in the TableCard the icon size no longer matches once it's next to the CardIcons, should we update the CardIcon size as well?

image

@CynZhang
Copy link

@scottdickerson yes, those icons in the toolbar should all be 16px. Can you also check if the icon colors are the same?

@tay1orjones tay1orjones changed the title feat(table): add tooltips to buttons and shrink icon size to 16 px feat(table): add tooltips to buttons and shrink icon size to 16 px, upgrade Carbon to v10.12.0 Jun 1, 2020
Comment on lines +19368 to +19374
use-resize-observer@^6.0.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/use-resize-observer/-/use-resize-observer-6.1.0.tgz#d4d267a940dbf9c326da6042f8a4bb8c89d29729"
integrity sha512-SiPcWHiIQ1CnHmb6PxbYtygqiZXR0U9dNkkbpX9VYnlstUwF8+QqpUTrzh13pjPwcjMVGR+QIC+nvF5ujfFNng==
dependencies:
resize-observer-polyfill "^1.5.1"

Copy link
Member

Choose a reason for hiding this comment

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

This is coming from Carbon. We use an older version. It would be very beneficial if we updated our version of this dep to also use v6.1.

I've created a separate issue #1250 but we can include here if you'd prefer @scottdickerson

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

#1253 Will fix the heap out of memory issue - lets wait to merge this until that one is in.

#1253 (comment):
A bit more context on this heap out of memory issue: it's a storybook issue with terser and react-docgen. It should be totally resolved in v6, but upgrading to Node 12 is a workaround.

@scottdickerson
Copy link
Contributor Author

@tay1orjones thanks for the fix, I put in the PR with a dependency on yours, and it should be ready to go now

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Node 12 PR is in, which should resolve the heap error we saw.

I pulled down the branch and verified locally - yarn start works fine on Node 12.17.0 👍

Comment on lines +6095 to +6100
carbon-components-react@7.12.0:
version "7.12.0"
resolved "https://registry.yarnpkg.com/carbon-components-react/-/carbon-components-react-7.12.0.tgz#d41125e774fa40e5c5fbc1d536c1923111273f6b"
integrity sha512-zsVD9/Dh8Rgl9LOO7vltS8AXj14eCbmSddQrDMkHeq5JSpQWtIqUAI7A7sT2uAhmowi1hk8d0BAroyGzhLHzAg==
dependencies:
"@carbon/icons-react" "^10.9.3"
"@carbon/icons-react" "^10.11.0"
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we should've upgraded icons-react too. I've opened a new PR: #1263

@tay1orjones
Copy link
Member

🎉 This PR is included in version 2.84.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants