-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Multiline Input and consistent alignment #4270
Conversation
17d1721
to
9fb8002
Compare
Also clean up alignment of floating labels / hints / text.
Due to the internals of the material-ui TextField, it is difficult for us to expand the height of an input field to contain the hint. As a quick and dirty workaround, let's compromise by clipping the hint to the size of the input.
9fb8002
to
450469c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q
@@ -6,7 +6,7 @@ export type SmallInputProps = { | |||
hintText: string, | |||
label: string, | |||
value: ?string, | |||
onChange: (next: string) => void, | |||
onChange?: (next: string) => void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this optional now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this since <Input>
's onChange
is similarly optional. I noticed this because I didn't specify handlers in the dumb sheet. It looks like in general we don't require event handlers in the other events of the <Input>
flowtype.
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -6,7 +6,7 @@ export type SmallInputProps = { | |||
hintText: string, | |||
label: string, | |||
value: ?string, | |||
onChange: (next: string) => void, | |||
onChange?: (next: string) => void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change plz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
This branch adds a bunch of fiddly tweaks to the
<Input>
element to enable it to serve as a multi-line input, allowing us to remove<MultiLineInput>
, which is currently a separate code path. The styling of the hint position, spacing between underline and input text, and floating text position have been tweaked to better match the style guide as well as each other in the different combinations of multiline / floating label / hint. Special attention was paid to lining up the gray placeholder text baseline with the black value text.It's a big improvement, but it isn't perfect -- in the interest of time, this is a 90% effort. We're kind of pushing the limits of what's convenient to style in the Material-UI
<TextField>
. The next step would be to write our own component, but I've tried hard not to resort to that here, merely taking out some of the hacks and fiddling with the styling to get it mostly right. In the future pass we should probably write a component that serves our needs precisely.One compromise I had to make to merge the inputs was dropping support for expanding inputs to fit the size of their hint text. Previously, the paper key inputs would expand to contain a multi-line hint with the full length of a paper key. Now the hint gets constrained to the space of the single-line empty input. I've discussed this change w/ design and it's ok to move forward with.
I've checked the impact of these changes by running local visdiffs during development and resolved the problems I could find.
This changeset will benefit from the Lato fonts update which will resolve some text measurement glitchiness.
👓 @keybase/react-hackers