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

Text field boxes + Ripple Improvements #801

Merged
merged 5 commits into from
Jun 15, 2017
Merged

Conversation

traviskaufman
Copy link
Contributor

This PR constitutes a number of commits which resolve #673 and should be rebased and merged.

  • fix(ripple): Remove fg deactivation class when animation finishes
  • feat(ripple): Add layout() method to component
  • feat(ripple): Reduce the fade out time for foreground ripple effect
  • feat(textfield): Implement text field boxes

@codecov-io
Copy link

codecov-io commented Jun 8, 2017

Codecov Report

Merging #801 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #801      +/-   ##
==========================================
+ Coverage   99.93%   99.93%   +<.01%     
==========================================
  Files          68       68              
  Lines        3134     3144      +10     
  Branches      384      387       +3     
==========================================
+ Hits         3132     3142      +10     
  Misses          2        2
Impacted Files Coverage Δ
packages/mdc-textfield/constants.js 100% <ø> (ø) ⬆️
packages/mdc-ripple/constants.js 100% <ø> (ø) ⬆️
packages/mdc-ripple/foundation.js 100% <100%> (ø) ⬆️
packages/mdc-textfield/index.js 100% <100%> (ø) ⬆️
packages/mdc-ripple/index.js 100% <100%> (ø) ⬆️

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 307305c...4c45efb. Read the comment docs.

Copy link
Contributor

@yeelan0319 yeelan0319 left a comment

Choose a reason for hiding this comment

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

Here is a weird bug on my end.

If you select dark mode, right click on the box, left click outside the box to turn off the menu, left click again outside the box. You will see:
screen shot 2017-06-09 at 14 11 40

Not sure what causes this yet, @traviskaufman maybe you have a quick answer?

position: absolute;
top: 0;
left: 0;
// TODO ripple positioning logic?
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this associate with other issues? Feel better to leave a reference 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.

Old TODO :p removing

assert.isNull(component.ripple);
});

test('#constructor initializes a default ripple when no ripple factory given when given a ' +
Copy link
Contributor

Choose a reason for hiding this comment

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

How about "constructor initializes a default ripple when ripple factory is not given in mdc-textfield--box element?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That to me sounds like there's some "ripple factory" inside of an mdc-textfield--box element. How about: "#constructor when given a mdc-textfield--box element, initializes a default ripple when no ripple factory given"

function setupTest() {
const root = getFixture();
const component = new MDCTextfield(root);
return {root, component};
}

test('#adapter.initialSyncWithDom', () => {
test('#initialSyncWithDom', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about "#initialSyncWithDom set disable to false"?

Copy link
Contributor

@amsheehan amsheehan left a comment

Choose a reason for hiding this comment

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

One question and a few small issues, otherwise looks good!

bottom: 0;
left: 0;
width: 100%;
height: 1px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be higher? Spec says even when idle and empty, it should be 2dp, and the visual examples make the bottom line look taller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah so this is a change that hasn't yet made it into spec. When we implement #675 it'll elevate to 2dp on hover, and stay at 2dp on focus.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

tfEl.classList[evt.target.checked ? 'add' : 'remove']('mdc-textfield--dense');
tf.ripple.layout();
});
}, 80);
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't need to be 80. Can just be 0 so it's at the end of the execution queue. I feel like potentially the issue is that by us using an arbitrary value, users just cutting and pasting code may think they need to do the same thing. To me, 0 seems like less of a directive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah agreed that 0 is better; I didn't realize we could use 0. Hopefully sometime soon we'll have a more robust solution for loading these demo styles.

@@ -181,6 +181,10 @@ such as a `mousedown` or a `pointerdown` event). It expands from the center.
Triggers a deactivation of the ripple (the second stage, which happens when the ripple surface is engaged via
interaction, such as a `mouseup` or a `pointerup` event). It expands from the center.

#### MDCRipple.layout()
Copy link
Contributor

Choose a reason for hiding this comment

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

Yay!


&.mdc-ripple-upgraded {
@include mdc-ripple-base;
// TODO: Add ::before as ripple bg once #194 lands
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the background fade out on the hover ripple doesn't exist, making it seem like it disappears very abruptly on interaction end events (moving the pointer out of the target). Do you have any sense of whether or not this component will receive ink wash on hover as a result of #194 ?

If it does not I think it will solve this problem as the ripple on click interactions fades out as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amsheehan yeah it will. There is a fade out, but it is very quick (<100ms). You can see it in devtools if you slow down the animations using the "Animations" tab. I worked with motion design on it and they signed off on it, so I'm assuming it's correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Curious. I had initially slowed it down but still couldn't see it animating out. I'm thinking the darker background of the text box background is the same color as the ink wash, which makes it appear as though there is no fade out. All the user can see is the foreground ripple (which doesn't animate out afaik)

Either way, if motion signed off, that's good enough for me. 👍

@amsheehan
Copy link
Contributor

Can I make a request that we make the docs changes to full width text fields part of this PR? Essentially we need to note that full width text fields do not support labels. Eh?

- Remove foreground deactivation class after fg-opacity-out animation
  finishes such that additional repaints for the element don't retrigger
  animations.
Change made after additional review from the team's motion designers.
@traviskaufman
Copy link
Contributor Author

@amsheehan I can add the note about full width textfields as part of this PR for sure.

@traviskaufman
Copy link
Contributor Author

@yeelan0319 @amsheehan PTAL!

@yeelan0319 That bug looks like it's for the ripple. I will file an issue for it.

@yeelan0319
Copy link
Contributor

@traviskaufman SGTM. LGTMed this PR.

@traviskaufman traviskaufman merged commit 184897b into master Jun 15, 2017
@traviskaufman traviskaufman deleted the feat/text-field-box branch June 15, 2017 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Text Field Boxes
4 participants