fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Link: Focus border doesn't wrap properly for links that span multiple lines

Open luhu opened this issue 9 years ago • 6 comments

Bug Report

  • Package version(s): (0.78.2~latest)
  • Browser and OS versions: (Chrome, IE 10+, Edge, FF)

Describe the issue:

The focus border of the link can't wrap all text of the link if the text of the Link displays more than 1 line.

Actual behavior:

The focus border wraps part of the link text. link-focus-issue

Expected behavior:

The focus border wraps all the link text.

If applicable, please provide a codepen repro:

http://codepen.io/luhu/pen/JbaOBL

  1. Inside the preview, press 'tab' to focus the link.
  2. See the focus border wraps part of the link text.

luhu avatar Dec 12 '16 14:12 luhu

The focus-border() mixin uses absolute positioning for the border. The problem is that links are display: inline by default, so the positioning doesn't work.

It works if the link is display: inline-block: http://codepen.io/mikewheaton/pen/xRajRy

However, using the mixin to change the display value is likely to result in some layout issues, and it would require JS to make sure we only change elements that are display: inline. To leave the layout intact we may need to measure inline elements and set the width of the focus border.

mikewheaton avatar Dec 12 '16 17:12 mikewheaton

inline multiple link unexpected behavior

I also realized there may be some case that we just want to show an inline link, and would like to add some additional information here:

  • Actual behavior: the focus border warps part of the link text: image
  • Expected behavior: This is the default behavior of <a> image

MirandaGe avatar Dec 13 '16 02:12 MirandaGe

Very good point. I think the best solution here is to not use the focus-border() mixin for the Link component. Instead, we can use the standard outline property to get this result:

image CodePen demo

mikewheaton avatar Dec 13 '16 15:12 mikewheaton

@mikewheaton do you have a PR for this?

dzearing avatar Jan 04 '17 22:01 dzearing

@dzearing I've assigned this to myself, should have a PR in tomorrow. 😊

mikewheaton avatar Jan 04 '17 23:01 mikewheaton

Sounds good, thanks!

dzearing avatar Jan 05 '17 01:01 dzearing