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

fix(Alert, NotificationDrawer): Added tooltips to truncated titles #5043

Merged
merged 6 commits into from
Oct 26, 2020

Conversation

tlabaj
Copy link
Contributor

@tlabaj tlabaj commented Oct 22, 2020

What: Added tooltips to truncated titles for Alert, NotificationDrawerListItemHeader and NotificationDrawerGroup.
Added truncatedTitle Prop to demo app and updated integration test
Closes #4760
Closes #4752

@patternfly-build
Copy link
Contributor

patternfly-build commented Oct 22, 2020

mcarrano
mcarrano previously approved these changes Oct 22, 2020
Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

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

Looks great @tlabaj .

redallen
redallen previously approved these changes Oct 22, 2020
Copy link
Contributor

@redallen redallen left a comment

Choose a reason for hiding this comment

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

LGTM! Since this pattern has become so pervasive we should make a hook for it in the future.

Copy link
Contributor

@jessiehuff jessiehuff left a comment

Choose a reason for hiding this comment

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

I'd recommend following what we currently do with chipgroup by adding a tabindex="0" to the div of the notification drawer group title like this: <div class="pf-c-notification-drawer__group-toggle-title" aria-describedby="pf-tooltip-139" tabindex="0">Third notification group. This is a long title to show how the title will be truncated if it is long and will be shown in a single line.</div>
And add the tabindex="0" on the <h4> of the alerts. This will allow keyboard users to see the tooltips.

kmcfaul
kmcfaul previously approved these changes Oct 22, 2020
Copy link
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

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

LGTM

@tlabaj tlabaj dismissed stale reviews from kmcfaul and redallen via acd7e26 October 22, 2020 20:25
jessiehuff
jessiehuff previously approved these changes Oct 23, 2020
Copy link
Contributor

@jessiehuff jessiehuff left a comment

Choose a reason for hiding this comment

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

LGTM! :)

@@ -43,6 +44,8 @@ export interface AlertProps extends Omit<React.HTMLProps<HTMLDivElement>, 'actio
onTimeout?: () => void;
/** Truncate title to number of lines */
truncateTitle?: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

does changing the value of truncateTitle have an effect? It doesn't seem to have the effect indicated in the documentation of limiting to be the number of lines? From what I see it's one line in each case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch. That is a regression. I am looking at it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mcoker when we apply the tooltip, it looks like the maxLines value we set is not applied. Do you have an ideas why that is? If i se the truncateTile to a number greater than the number of line of text, that work because we do not have a tooltip. But if we have a tooltip, it always truncates to 1 line.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there is some problem here

titleRef.current.style.setProperty(maxLines.name, truncateTitle.toString());

This should create an inline style that defines --pf-c-alert__title--max-lines with the value of the truncate prop. Should look like this

Screen Shot 2020-10-23 at 12 37 48 PM

@codecov-io
Copy link

Codecov Report

Merging #5043 into master will decrease coverage by 0.04%.
The diff coverage is 41.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5043      +/-   ##
==========================================
- Coverage   52.17%   52.13%   -0.05%     
==========================================
  Files         535      535              
  Lines        9827     9848      +21     
  Branches     3629     3641      +12     
==========================================
+ Hits         5127     5134       +7     
- Misses       4038     4045       +7     
- Partials      662      669       +7     
Flag Coverage Δ
#patternfly4 52.13% <41.66%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...nts/NotificationDrawer/NotificationDrawerGroup.tsx 50.00% <28.57%> (-8.83%) ⬇️
...icationDrawer/NotificationDrawerListItemHeader.tsx 68.00% <44.44%> (-15.34%) ⬇️
packages/react-core/src/components/Alert/Alert.tsx 72.72% <50.00%> (-5.66%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62c366f...03813c1. Read the comment docs.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

lgtm!

@redallen redallen merged commit eb77e52 into patternfly:master Oct 26, 2020
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-catalog-view-extension@4.8.88
  • @patternfly/react-core@4.75.1
  • @patternfly/react-datetime@4.2.33
  • @patternfly/react-docs@5.10.48
  • @patternfly/react-inline-edit-extension@4.5.146
  • demo-app-ts@4.58.3
  • @patternfly/react-integration@4.58.1
  • @patternfly/react-table@4.19.4
  • @patternfly/react-topology@4.6.53
  • @patternfly/react-virtualized-extension@4.5.133

Thanks for your contribution! 🎉

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