Skip to content

Link: Fixed state bugs#3471

Merged
lynamemi merged 9 commits into
microsoft:masterfrom
lynamemi:link-states
Dec 12, 2017
Merged

Link: Fixed state bugs#3471
lynamemi merged 9 commits into
microsoft:masterfrom
lynamemi:link-states

Conversation

@lynamemi

Copy link
Copy Markdown
Collaborator

Pull request checklist

Description of changes

  • UHF was overwriting Link styles in the website documentation (this has been fixed in links throughout the website page links, but not the Link component itself) so I made mixins that we can borrow in the example scss to have deeper selectors for the website's link example styling
  • Link rendered as a button did not receive the proper class so was missing state styles
  • Added aria-disabled prop so the screen reader will read that a given link is disabled. Since we have a custom prop for disabled, we need this.

Before:
image

After:
image

Focus areas to test

(optional)

@micahgodbolt

Copy link
Copy Markdown
Member

@betrue-final-final do you want to take a look at the diffs in screener. the color has certainly changed.

Also @lynamemi, are there some additional "stories" we could be testing on this component? I you haven't done it before, I'd be happy to give you a hand.

@lynamemi

Copy link
Copy Markdown
Collaborator Author

I will take a look @micahgodbolt !

@lynamemi

Copy link
Copy Markdown
Collaborator Author

@micahgodbolt Pushed some stories. Let me know what you think.

exports[`Link renders disabled Link correctly 1`] = `
<a
aria-disabled={true}
className="ms-Link is-disabled undefined"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"undefined" on the classname seems like a bug

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@lynamemi can you double check that classname and styles.root are working? would be nice to not have this undefined value here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I followed up with you more on Teams for extra context, but essentially, css("classname" + styles.foo) will always return "classname undefined" because of our jest config. There is a lot of precedence in fabric react for keeping it this way, but I can separate the two styles out on separate lines to get rid of undefined:
disabled && 'is-disabled
disabled && styles.disabled

  • see David's comment below

styles.root,
className,
disabled && ('is-disabled ' + styles.isDisabled)
disabled && ('is-disabled ' + styles.isDisabled),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if "styles.isDisabled" is undefined... what happens?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just trying to figure out why the snapshot has "undefined" in the classname.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

per offline discussion, I'll leave this as is because it's a nuance of how the jest config treats scss

@betrue-final-final

Copy link
Copy Markdown
Contributor

@micahgodbolt, I was working with @lynamemi, but when screener picks up the diff I'll take a look!

@lynamemi

lynamemi commented Dec 1, 2017

Copy link
Copy Markdown
Collaborator Author

@betrue-final-final I don't think screener will pick up these fixes. The styles (colors and states) where mostly right already, it was the config and our website that was buggy. And it doesn't look like there is a screener for Link: No href: disabled. Maybe we can add one?

@lynamemi

lynamemi commented Dec 1, 2017

Copy link
Copy Markdown
Collaborator Author

talked to Ben and just realized adding snapshots is not the same as adding stories 😄
New story forthcoming!

@lynamemi

lynamemi commented Dec 5, 2017

Copy link
Copy Markdown
Collaborator Author

bump for @micahgodbolt - new tests added!

@lynamemi lynamemi closed this Dec 12, 2017
@lynamemi lynamemi reopened this Dec 12, 2017
@lynamemi

Copy link
Copy Markdown
Collaborator Author

@micahgodbolt I think everything in this PR has been resolved - can I get an approval to get this merged in?

@lynamemi

Copy link
Copy Markdown
Collaborator Author

Thanks Micah!

@lynamemi
lynamemi merged commit 8146c71 into microsoft:master Dec 12, 2017
@lynamemi
lynamemi deleted the link-states branch December 12, 2017 19:02
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link control needs to set aria-disabled attribute on disabled state

4 participants