Skip to content

Link: Adding underline prop#16625

Merged
ecraig12345 merged 12 commits intomicrosoft:masterfrom
khmakoto:linkUnderline
Jan 29, 2021
Merged

Link: Adding underline prop#16625
ecraig12345 merged 12 commits intomicrosoft:masterfrom
khmakoto:linkUnderline

Conversation

@khmakoto
Copy link
Member

Pull request checklist

Description of changes

This PR adds an underline prop that provider underline styling to the Link component. This is done to add a styling difference in places where color is not enough contrast to differentiate the Link (i.e. cases where the Link is alongside other text).

@fabricteam
Copy link
Collaborator

fabricteam commented Jan 26, 2021

Perf Analysis

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 876 827 5000
BaseButtonCompat mount 917 916 5000
Breadcrumb mount 43769 43889 5000
Checkbox mount 1522 1496 5000
CheckboxBase mount 1228 1254 5000
ChoiceGroup mount 4682 4786 5000
ComboBox mount 986 1015 1000
CommandBar mount 10213 10080 1000
ContextualMenu mount 6087 6200 1000
DefaultButtonCompat mount 1115 1149 5000
DetailsRow mount 3564 3719 5000
DetailsRowFast mount 3864 3683 5000
DetailsRowNoStyles mount 3401 3488 5000
Dialog mount 1425 1436 1000
DocumentCardTitle mount 1784 1775 1000
Dropdown mount 3278 3239 5000
FocusTrapZone mount 1747 1815 5000
FocusZone mount 1798 1894 5000
IconButtonCompat mount 1793 1711 5000
Label mount 343 317 5000
Layer mount 1831 1759 5000
Link mount 503 446 5000
MakeStyles mount 2218 2290 50000
MenuButtonCompat mount 1503 1448 5000
MessageBar mount 1999 1992 5000
Nav mount 3292 3302 1000
OverflowSet mount 1009 1100 5000
Panel mount 1412 1548 1000
Persona mount 864 887 1000
Pivot mount 1439 1425 1000
PrimaryButtonCompat mount 1340 1308 5000
Rating mount 7661 7689 5000
SearchBox mount 1277 1272 5000
Shimmer mount 2490 2523 5000
Slider mount 1940 1888 5000
SpinButton mount 4967 5004 5000
Spinner mount 427 408 5000
SplitButtonCompat mount 3165 3072 5000
Stack mount 483 494 5000
StackWithIntrinsicChildren mount 1502 1503 5000
StackWithTextChildren mount 4472 4441 5000
SwatchColorPicker mount 10452 10380 5000
Tabs mount 1412 1421 1000
TagPicker mount 3018 3015 5000
TeachingBubble mount 11822 11731 5000
Text mount 409 409 5000
TextField mount 1366 1368 5000
ThemeProvider mount 2215 2218 5000
ThemeProvider virtual-rerender 671 644 5000
Toggle mount 780 870 5000
button mount 692 669 5000
buttonNative mount 117 114 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🦄 Avatar.Fluent 0.17 0.51 0.33:1 2000 339
🦄 Button.Fluent 0.12 0.2 0.6:1 5000 595
🔧 Checkbox.Fluent 0.68 0.37 1.84:1 1000 677
🎯 Dialog.Fluent 0.16 0.22 0.73:1 5000 813
🔧 Dropdown.Fluent 3.03 0.41 7.39:1 1000 3026
🔧 Icon.Fluent 0.14 0.06 2.33:1 5000 697
🦄 Image.Fluent 0.08 0.13 0.62:1 5000 410
🔧 Slider.Fluent 1.61 0.44 3.66:1 1000 1614
🔧 Text.Fluent 0.07 0.03 2.33:1 5000 373
🦄 Tooltip.Fluent 0.12 0.91 0.13:1 5000 583

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
RefMinimalPerf.default 268 240 1.12:1
TextMinimalPerf.default 403 360 1.12:1
AttachmentMinimalPerf.default 181 166 1.09:1
DatepickerMinimalPerf.default 52974 48600 1.09:1
ListNestedPerf.default 592 559 1.06:1
AttachmentSlotsPerf.default 1292 1225 1.05:1
BoxMinimalPerf.default 404 384 1.05:1
ChatWithPopoverPerf.default 486 465 1.05:1
GridMinimalPerf.default 374 356 1.05:1
PortalMinimalPerf.default 180 172 1.05:1
TreeWith60ListItems.default 192 183 1.05:1
Icon.Fluent 697 666 1.05:1
ButtonMinimalPerf.default 197 190 1.04:1
CardMinimalPerf.default 602 579 1.04:1
FormMinimalPerf.default 434 419 1.04:1
ImageMinimalPerf.default 426 409 1.04:1
LabelMinimalPerf.default 442 426 1.04:1
Button.Fluent 595 573 1.04:1
AnimationMinimalPerf.default 427 413 1.03:1
AlertMinimalPerf.default 321 315 1.02:1
AvatarMinimalPerf.default 216 212 1.02:1
ButtonUseCssPerf.default 885 868 1.02:1
ChatMinimalPerf.default 664 653 1.02:1
EmbedMinimalPerf.default 4188 4121 1.02:1
HeaderSlotsPerf.default 808 790 1.02:1
TableMinimalPerf.default 434 426 1.02:1
Checkbox.Fluent 677 664 1.02:1
ButtonSlotsPerf.default 630 625 1.01:1
DividerMinimalPerf.default 400 396 1.01:1
DropdownManyItemsPerf.default 758 753 1.01:1
ListMinimalPerf.default 513 510 1.01:1
LoaderMinimalPerf.default 746 742 1.01:1
ProviderMergeThemesPerf.default 1628 1615 1.01:1
SkeletonMinimalPerf.default 384 380 1.01:1
SplitButtonMinimalPerf.default 3855 3831 1.01:1
IconMinimalPerf.default 710 702 1.01:1
TableManyItemsPerf.default 2140 2126 1.01:1
CustomToolbarPrototype.default 3886 3852 1.01:1
TooltipMinimalPerf.default 839 833 1.01:1
TreeMinimalPerf.default 816 805 1.01:1
VideoMinimalPerf.default 703 693 1.01:1
Dialog.Fluent 813 808 1.01:1
Image.Fluent 410 407 1.01:1
DropdownMinimalPerf.default 3022 3010 1:1
InputMinimalPerf.default 1323 1325 1:1
ListWith60ListItems.default 653 653 1:1
MenuMinimalPerf.default 867 870 1:1
MenuButtonMinimalPerf.default 1575 1574 1:1
ToolbarMinimalPerf.default 977 973 1:1
Dropdown.Fluent 3026 3037 1:1
Slider.Fluent 1614 1621 1:1
ButtonOverridesMissPerf.default 1783 1795 0.99:1
ButtonUseCssNestingPerf.default 1134 1141 0.99:1
CarouselMinimalPerf.default 505 508 0.99:1
ChatDuplicateMessagesPerf.default 394 398 0.99:1
CheckboxMinimalPerf.default 2957 2974 0.99:1
ItemLayoutMinimalPerf.default 1239 1251 0.99:1
LayoutMinimalPerf.default 432 438 0.99:1
StatusMinimalPerf.default 760 765 0.99:1
TextAreaMinimalPerf.default 496 502 0.99:1
HeaderMinimalPerf.default 402 411 0.98:1
ListCommonPerf.default 679 691 0.98:1
SegmentMinimalPerf.default 363 371 0.98:1
SliderMinimalPerf.default 1621 1662 0.98:1
DialogMinimalPerf.default 794 816 0.97:1
FlexMinimalPerf.default 312 323 0.97:1
Avatar.Fluent 339 349 0.97:1
Text.Fluent 373 384 0.97:1
Tooltip.Fluent 583 604 0.97:1
ProviderMinimalPerf.default 986 1024 0.96:1
RadioGroupMinimalPerf.default 447 468 0.96:1
ReactionMinimalPerf.default 411 427 0.96:1
RosterPerf.default 1189 1258 0.95:1
PopupMinimalPerf.default 704 752 0.94:1
AccordionMinimalPerf.default 155 187 0.83:1

@size-auditor
Copy link

size-auditor bot commented Jan 26, 2021

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 16f45ce178b34cb87e9f8bcc8bfa0299c540c085 (build)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 26, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8572a0c:

Sandbox Source
Fluent UI Button Configuration

Copy link
Member

@ecraig12345 ecraig12345 left a comment

Choose a reason for hiding this comment

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

Couple minor suggestions but otherwise LGTM, thanks!

className?: string;
isButton?: boolean;
isDisabled?: boolean;
isUnderlined?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if this should be called just underline to match the prop name? But I could go either way on this since some of the other Link style props use the is convention.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, went with the convention here but I can change that if wanted.

a: {
component: MarkdownLink,
props: { className: 'ms-mdLink', styles: subComponentStyles.link },
props: { className: 'ms-mdLink', styles: subComponentStyles.link, underline: false },
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused, how did this fix it? I would have expected it to make the links never have an underline?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm I don't think this is right, because it removes the underlines by default. I think links in markdown really ought to be underlined by default, for example these ones.
image

Copy link
Member

Choose a reason for hiding this comment

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

To clarify, the reason I think markdown links ought to be underlined by default is because markdown is for body text, and links in body text should be underlined.

Copy link
Member

Choose a reason for hiding this comment

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

Ok thinking about this more, the best solution I can see is different handling of related links all-up (pass an array not use markdown...there's no reason to define a bunch of identically formatted ULs in markdown).

So my suggestion for this PR would be to revert this line (so that all the links except related are correctly underlined), and I'll make a follow-up changing the related link formatting.

@ecraig12345 ecraig12345 merged commit 68e4055 into microsoft:master Jan 29, 2021
@khmakoto khmakoto deleted the linkUnderline branch January 30, 2021 02:14
@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-docsite-components@v8.0.0-beta.46 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-link@v1.0.0-beta.38 has been released which incorporates this pull request.:tada:

Handy links:

msft-fluent-ui-bot pushed a commit that referenced this pull request Feb 18, 2021
#### Pull request checklist

- [x] Addresses an existing issue: Fixes #16302
- [x] Include a change request file using `$ yarn change`

#### Description of changes

_Port of #16625 and #16721_

This PR adds an `underline` prop that provider underline styling to the `Link` component. This is done to add a styling difference in places where color is not enough contrast to differentiate the `Link` (i.e. cases where the `Link` is alongside other text).
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.

Insufficient contrast between links and surrounding text

5 participants