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: added descriptive text for tooltips #17321

Merged
merged 4 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const MenuItem = (props) => {
const descriptionTextStyle = StyleUtils.combineStyles([
styles.textLabelSupporting,
(props.icon ? styles.ml3 : undefined),
styles.breakWord,
styles.breakAll,
styles.lineHeightNormal,
props.title ? descriptionVerticalMargin : undefined,
], props.style);
Expand All @@ -86,6 +86,7 @@ const MenuItem = (props) => {
styles.popoverMenuItem,
StyleUtils.getButtonBackgroundColorStyle(getButtonState(props.focused || hovered, pressed, props.success, props.disabled, props.interactive), true),
..._.isArray(props.wrapperStyle) ? props.wrapperStyle : [props.wrapperStyle],
styles.popoverMaxWidth,
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why add this style here instead of to descriptionTextStyle like you suggested in the proposal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding width of 375px to the descriptionTextStyle would not take into account the padding that is on this container. This will cause the issue highlighted by @shawnborton here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can set the width of descriptionTextStyle to be 375px - padding on container. That will solve the issue as well but I found the above approach to be more cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense, and I agree this is cleaner, thanks!

])}
disabled={props.disabled}
>
Expand Down
3 changes: 1 addition & 2 deletions src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import CONST from '../../../../CONST';
import getAttachmentDetails from '../../../../libs/fileDownload/getAttachmentDetails';
import fileDownload from '../../../../libs/fileDownload';
import addEncryptedAuthTokenToURL from '../../../../libs/addEncryptedAuthTokenToURL';
import * as ContextMenuUtils from './ContextMenuUtils';
import * as Environment from '../../../../libs/Environment/Environment';
import Permissions from '../../../../libs/Permissions';
import QuickEmojiReactions from '../../../../components/Reactions/QuickEmojiReactions';
Expand Down Expand Up @@ -119,7 +118,7 @@ export default [
Clipboard.setString(selection);
hideContextMenu(true, ReportActionComposeFocusManager.focus);
},
getDescription: ContextMenuUtils.getPopoverDescription,
getDescription: selection => selection,
},
{
textTranslateKey: 'reportActionContextMenu.copyEmailToClipboard',
Expand Down
17 changes: 0 additions & 17 deletions src/pages/home/report/ContextMenu/ContextMenuUtils/index.js

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3078,6 +3078,10 @@ const styles = {
width: variables.modalContentMaxWidth,
textAlign: 'center',
},

popoverMaxWidth: {
maxWidth: 375,
},
};

export default styles;