-
Notifications
You must be signed in to change notification settings - Fork 4
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
<Input /> v2 #47
<Input /> v2 #47
Conversation
The pass-through technique might not be desirable in a library. It can create situations that make it hard to deprecate unforeseen usages of a given component. We should try to stick to supporting a minimal set of components which provide the look and feel of Mavenlink -- not an end-all developer tool.
This ensures we are always accessible and aligns with our design vision moving forward. Simplifies how to use the <Input> and thus minimizes our maintenance risk for the future.
…em-partII' into input
… test -u` or `yarn test --update` It is part of the docs.
Closes #34 |
…guring host applications
…ut it. Add disabled example for us to implement and style later.
Avoids the icon overflowing the input when the label is too large. Signed-off-by: Rob Levin <[email protected]>
…t that excludes node_modules
Signed-off-by: Rob Levin <[email protected]>
Signed-off-by: Rob Levin <[email protected]>
Remove unnecessary <div> container on <Input>
Signed-off-by: Rob Levin <[email protected]>
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.
@juanca I've added several questions and comments on the input api—I know you've mentioned you'll be perusing PRs while in your travels, but I'm not sure how often. Since this is meant to set a precedent from your email to me:
The button work and input work have set an interesting precedent of these.
I think my questions are important to resolve before moving on to new things e.g. the file input component...
Also, I see the base branch is all-svgs-in-internal-design-system-partII
, so I suppose that's meant to reinforce the relationship? and/or was your thought that since you'd be away, I should consider just merging it in to my work since we weren't able to get the <Input />
fully reviewed and merged before you left? I'm uncertain whether you considered this WIP or dev done.
This comment has been minimized.
This comment has been minimized.
Otherwise, we add yet another requirement on host applications when using this library.
We want other to use each individual component. This makes it easier for static analysis. _Maybe_ in the future we will reverse this decision.
Conflicts: src/components/button/button.jsx src/components/button/button.test.jsx
We want to only support text-like types. We might as well do it little by little. Otherwise, we could get into a situation where someone uses the input as a checkbox!
…t flows with its container. Ideally, usages of MDS Input should provide their own layout -- or possibly a cssContainer class name with a width.
This comment has been minimized.
This comment has been minimized.
</label> | ||
<div className={props.cssContainer}> | ||
<input | ||
className={getClassName(props.className, props.invalid)} |
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'm concerned about the number of configurations here. Are there things we could do, like advocate for the usage of native handlers for some of these?
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.
This is an opinionated implementation.
As you can see from the code removed section, the MDS Input v1 was just that -- it passed through all props onto the <input>
element. We thought that would be the best for MDS library but we saw incorrect usages of our MDS Input. Since we can just pass any kind of type
into the MDS input, we ended up in a situation where a feature team used our MDS input as a checkbox -- which basically gutted the whole thing.
Now, I think I understand the whole battle between configuration vs composition. While we do see many configuration options, I do not think this is a "configurable" component -- I think that is usually applied to components that change their behavior based on their properties. In this case, we are whitelisting the configuration options to the <input>
-- which means we want to control how much configuration is allowed for native elements.
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.
Time to have another look at typescript :) We're having same sorts of nuanced issues at my new place and have even gone so far as to throw a fatal Error if unrecognized props are passed in—this starts to make the code less readable and it's not fault tolerant per se. Typescript lets you know at compile time, you can just declare the interface you expect (prop-types is really not so great at enforcing and devs will just ignore warnings whereas an interface will be noisy at compile time and not let the application developers use incorrect props at all). It IS a PITA to configure TS at times though.
Something to maybe consider longer term I dunno :)
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'm definitely not comfortable with the idea that implementation issues should be solved by just switching languages, there's a wealth of baggage for any language. 😄 I do like the opinionated approach, but perhaps we could forward native event handlers specifically? That way our interface maintains at least part of the underlying HTML native interface, and the part that we need for proper usage of the component while also supporting wrappers for more advanced behavior.
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.
There are no native event handles in React! React uses its own event system (and, sure, it ties it into native event handles but that is abstracted away from us React developers).
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.
@roblevintennis Hello! 👋
Yeah, I'm on the same boat as always: I don't want to adopt yet another non-standard thing if I can post-pone it as long as possible. We adopted React and CSS Modules but we did wait a good 4 years before doing any of that. Hah, maybe in 4 years I'll consider TS. ;)
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 feel ya kinda ;) In this spirit of coding towards standards, I'd be very curious if esnext et al introduce some sort of notion of interfaces; although it's sort of useless as a runtime only thing imo (main thing is to get compile / transpile knowledge of bad inputs).
If you think about it, really, Webpack is a very specific way to set things up and many folks consider it extremely painful (folks at my new gig are in favor of using create react app or gatsby or something because they've tired of fighting Webpack). React leaves itself around in your code (e.g. read the philosophy of Svelte which compiles itself away). CSS Modules is really just a nifty spec which ala css-loader and Webpack does some name munging tricks, and as we know does not work perfectly (although I'm still using it as it's the least of all unfortunate options).
All to say, our jobs and lives in web-land are still a mess and not really so standards-based 😋 I am sad that my new gig is still quite rooted in Sass but maybe we'll get on the PostCSS train in 2020.
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.
there's a wealth of baggage for any language
Typescript is not really a language but more of a superset of JavaScript. Yes, there's some baggage, but also some benefits. Especially if you like to use inversion of control (which I know you loathe from a particular meeting I recall where we brought up DI and you were a bigtime detractor) @Bloodyaugust :)
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.
LGTM! We'll keep an eye on component complexity going forward.
Type of work: component
Deployment URL: https://mavenlink.github.io/design-system/input
(Optional for outside contributions) Tracked work in Mavenlink: https://www.pivotaltracker.com/story/show/165360149
Motivation
In order to better support MavenPages, we need an input component that is already accessible and forward-looking with design.
Version 2 of the input will bake in better accessibility by enforcing a label. It will also remove the pass-through properties interface to avoid consumer applications from misusing the input -- for example, we have a case where a developer used the input as a checkbox.
Misuses of components will create a maintenance burden in the future and misdirect vital demand information about MDS.
Useful resources:
Acceptance Criteria
Change log entry
Implement
<Input>
version 2. More accessible and better defined property interface.Improve
<Button>
: allowname
andvalue
properties.