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
[SelectField,TextField] Refactoring/Popover/Keyboard #3628
Conversation
adbf12c
to
f0b7887
Compare
@mbrookes - as discussed - sorry for the delay... few issues... |
@alitaheri - you might be interested in |
@@ -161,70 +168,172 @@ const SelectField = React.createClass({ | |||
}; | |||
}, | |||
|
|||
componentDidMount() { | |||
if (this.props.open) { | |||
/* eslint-disable */ |
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.
Small note: use rule specific comments for disabling, eg:
/* eslint react/no-did-mount-set-state: 0 */
Also, why do we need to use setState()
in componentDidMount
?
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 think it's needed, because we need to set an anchorElement for the popover. If you know a better way, I'd be happy to drop in!
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 have a couple of other things related to the state
I want to discuss, but just as a quickie: will it not work properly in componentWillMount
?
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.
it does work - didn't think it did...
@chrismcv Can we split out the smaller, unrelated tweaks into another PR? Also, I just want to make a note RE tests since you highlighted it: I'm not sure if the fact that tests don't already exist is a good reason not to add any. In fact, with a refactor to existing components, I'd argue that:
|
to confirm, by smaller do you mean changes to a) menu-item, b) date-picker-inline...? if so, yes... I think the rest is best dealt with as a whole. On the testing note... I agree, but as my original goal was adding keyboard support, introducing a full unit test suite for text field and select field seemed like a bit of a distraction. |
@chrismcv Yep, I think the |
@chrismcv Hmm. I've just realised that there is a problem with having @newoga I'm having 2nd thoughts about that suggestion I made RE Here's the problem: we have 2 sources of truth for (I still need to verify this, so correct me if I'm wrong!) edit removed something about |
@newoga Completely separate from my other feedback... Remember that one of the reasons we want to refactor |
@chrismcv Sorry for the intense reviewing 😆 the |
@chrismcv if you could summarize in one sentence: what's the main goal for the refactoring here? |
Yeah I think we have some design considerations we need to consider (for all of these components, but especially as it relates to TextField).
I'd be curious to hear this too. 😄 As @nathanmarks mentioned, there may be an opportunity to split this up, or to consider these changes holistically with some of the other design and performance considerations we've had recently. |
fill: accentColor, | ||
position: 'absolute', | ||
right: 0, | ||
top: 14, |
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.
any chance we can use flex box? 😁
The purpose of refactoring The purpose of refactoring |
@chrismcv Thanks, that's very helpful! I want to chat with @newoga some more about the pros/cons of this refactor and how it fits into fixes for the other issues that This would be my recommendation for next steps:
Thanks so much for the hard work, we really appreciate it. Does that plan sound good to you? |
@callemall/material-ui any opinions on this type of design if we refactor this for |
@chrismcv are you able to rebase this? |
@nathanmarks - to be honest, the amount of change in this vs the amount of change in the structure and layout of the project all likely means that redoing it from master will be cleaner (and less likely to break something subtle.) Happy to redo for |
@chrismcv let's get some more opinions -- I also need to revisit it myself too |
Can't test this branch due to not being able to build it with #4337. But by reading the comments, it looks like it will solve non tab-able dropdowns by making them tab-able. Is this something that might get merged into the next version? Would love to see tab-able dropdowns in an upcoming release |
@chrismcv closing this for now since you'd rather reimplement it anyways -- but let's revisit after style changes. |
This PR does several things...
<SelectField />
no longer uses dropdown menu<TextFieldDecorator />
which is used to wrap an input element e.g.TextInput
orSelectInput
withfloatingLabel
,errorText
, "animated underline of focus". (This one is quite a useful change moving forward. I'm not sure about the naming (as decorator has ES7 implications), so any thoughts welcome...)<TextField />
and<TextFieldMultiline />
in due course.3, Adds keyboard support to
SelectField
([SelectField] Keyboard navigation support #3583)open
support toSelectField
superceding https://github.com/callemall/material-ui/pull/3403/files